我需要創建一個宏,該宏將在某個列爲true時複製表的所有行。如何在Excel中複製表格中的行
我錄製一個宏,它給了我這樣的:
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4, Criteria1:= "TRUE"
Range("Table1").Select
Application.CutCopyMode = False
Selection.Copy
Range("A22").Select 'To be replaced with a method that finds the last cell.
'Selection.End(xlDown).Select gives me the last row in the table, but I want the one under that.
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=12
不過之前我深入研究它,我想知道什麼是最好的/最快的方法?
所以你打算過濾它,然後只複製可見行? 'specialcells(xlvisible)'將通過可見單元格。或者你打算使用'if'a column = true,然後複製'.entirerow'? – Raystafarian
@Raystafarian可能第二個將是一個更好的選擇。 – David