过滤后,我想复制所有可见和非空单元格(包含文本的单元格)。出于某种原因,我当前的代码不起作用。任何帮助将不胜感激。谢谢!
Sheets("Sheet1").Range("S2:S5000").SpecialCells(xlCellTypeVisible).SpecialCells(xlCellTypeConstants).Copy
完全承认我没有尝试您的代码,但您也可以尝试以下
With Sheets("Sheet1").Range("S2:S5000")
Application.Intersect(.SpecialCells(xlCellTypeVisible), _
.SpecialCells(xlCellTypeConstants)).Copy
End With
开放式假设复制的原因是粘贴到其他地方,您可以使用更新上述代码
With Sheets("Sheet1").Range("S2:S5000")
Application.Intersect(.SpecialCells(xlCellTypeVisible), _
.SpecialCells(xlCellTypeConstants)).Copy _
Destination:= Sheets("destSheet").Range("destRange")
End With