我正在尝试应用 lastrow lastcolumn,但不正确。
我收到错误“提取的范围缺少或非法的字段名称”
谢谢
Sub FilterCopyToOtherSheet2()
Dim lastRow As Long
Dim lastCol As Long
Dim colChr As String
With Sheets("Comments-Tableau")
lastCol = .Cells(2, .Columns.Count).End(xlToLeft).Column
lastRow = .Cells(.Rows.Count, lastCol).End(xlUp).Row
End With
Sheets("Comments-Tableau").Range(Cells(2, 2), Cells(lastRow, lastCol)).AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("Comments").Range("A1"), _
Unique:=False
Application.DisplayAlerts = False
Sheets("Comments-Tableau").Delete
Application.DisplayAlerts = True
End Sub