我已经在此记录了一个宏,但它太笨重,我想将此应用于工作簿内所有工作表中的所有表(查询表和透视表除外)。我正在寻找一个不会太笨重且易于执行的宏。
这是我打算做的事情的宏记录我不太清楚周围的路,有人能帮忙吗?
`Sub ClearData()
'
' ClearData Macro
'
'
Range("GLORY_INYANG[[DATE]:[CREDIT (Payment)]]").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWindow.SmallScroll Down:=-201
Range("A17:E608").Select
ActiveWindow.SmallScroll Down:=-300
ActiveWindow.ScrollRow = 299
ActiveWindow.ScrollRow = 298
ActiveWindow.ScrollRow = 291
ActiveWindow.ScrollRow = 244
ActiveWindow.ScrollRow = 95
ActiveWindow.ScrollRow = 85
ActiveWindow.ScrollRow = 75
ActiveWindow.ScrollRow = 73
ActiveWindow.ScrollRow = 71
ActiveWindow.ScrollRow = 70
ActiveWindow.ScrollRow = 69
ActiveWindow.ScrollRow = 67
ActiveWindow.ScrollRow = 66
ActiveWindow.ScrollRow = 64
ActiveWindow.ScrollRow = 63
ActiveWindow.ScrollRow = 60
ActiveWindow.ScrollRow = 58
ActiveWindow.ScrollRow = 55
ActiveWindow.ScrollRow = 46
ActiveWindow.ScrollRow = 43
ActiveWindow.ScrollRow = 35
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 7
ActiveWindow.SmallScroll Down:=-30
Rows("25:1411").Select
Selection.Delete Shift:=xlUp
ActiveWindow.SmallScroll Down:=-6
Sheets("ELIZABETH GABRIEL").Select
Range("ELIZABETH_GABRIEL[[DATE]:[CREDIT (Payment)]]").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWindow.SmallScroll Down:=12
Rows("24:1346").Select
ActiveWindow.SmallScroll Down:=-1371
Rows("18:1289").Select
Selection.Delete Shift:=xlUp
Range("D20").Select
Sheets("GLORY INYANG").Select
Range("C27").Select
Sheets("GLORY INYANG").Select
Range("B25:E25").Select
Range("C25:E25").Select
Selection.FormulaR1C1 = "=SUBTOTAL(109,R[-18]C:R[-1]C)"
Sheets("ELIZABETH GABRIEL").Select
Selection.FormulaR1C1 = "=SUBTOTAL(109,R[-11]C:R[-1]C)"
Sheets("ABASIOFON MONDAY").Select
ActiveWindow.SmallScroll Down:=-87
Range("ABASIOFON_MONDAY[[DATE]:[CREDIT (Payment)]]").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Rows("18:1286").Select
Selection.Delete Shift:=xlUp
Range("C18:E18").Select
Selection.FormulaR1C1 = "=SUBTOTAL(109,R[-11]C:R[-1]C)"
ActiveWindow.SmallScroll Down:=-87
End Sub`
1条答案
按热度按时间oiopk7p51#
这是基本代码:
它将从表中删除行,但保留标题行和总计行