只复制可见的单元格

我试图复制可见的单元格使用我的filter后,在同一本书中的另一张表,但我不知道这个代码。 现在看起来如何:

Sub Button1_Click() Dim i As Integer Dim VisRan As Range VisRan = Sheets(1).Range("a39:bm29684").SpecialCells(xlCellTypeVisible) Visran.Copy Sheets(2).Cells(1, 1).Select Selection.Paste 

但它不起作用。 有什么问题?
Thx提前

试试这个:

 Sub Button1_Click() Dim i As Integer Dim VisRan As Range On Error Resume Next Set VisRan = Sheets(1).Range("a39:bm29684").SpecialCells(xlCellTypeVisible) On Error GoTo 0 If VisRan Is Nothing Then MsgBox "There is no visible rows" Exit Sub End If VisRan.Copy Destination:=Sheets(2).Cells(1, 1) End Sub