0
我有一些問題與我的VBA代碼。 這就是我想做的事:高級過濾器複製到另一個工作簿
- 從薄片採取的路徑(輸入)
- 打開相關工作簿
- 使用先進的過濾器在打開的60只的所需的列複製文件複製到原始文件。
- 關閉文件
我知道代碼部分是硬編碼,到目前爲止,並具有一定的膨脹,但請忽略它。
當我運行vba時,高級篩選器行中出現運行時錯誤438(屬性或方法不受支持)。
這是我的代碼:
Public strFileName As String
Public currentWB As Workbook
Public dataWB As Workbook
Public strCopyRange As String
Public rngFiltro As Variant
Sub PrendiDati()
Dim strListSheet As String
Dim rngFonte As Variant
strListSheet = "input"
'On Error GoTo ErrH
Application.Calculation = xlCalculationManual
ActiveWorkbook.Worksheets("SCADENZIARIO").Range("A2:R15000").Clear
Sheets(strListSheet).Select
Range("b6").Select
'this is the main loop, we will open the files one by one and copy their data into the masterdata sheet
Set currentWB = ActiveWorkbook
strFileName = ActiveCell.Offset(0, 1) & ActiveCell.Value
strCopyRange = ActiveCell.Offset(0, 2) & ":" & ActiveCell.Offset(0, 3)
strWhereToCopy = ActiveCell.Offset(0, 4).Value
strStartCellColName = Mid(ActiveCell.Offset(0, 5), 2, 1)
Application.Workbooks.Open strFileName, UpdateLinks:=False
Set dataWB = ActiveWorkbook
dataWB.Worksheet(1).Range("Database").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=currentWB.Sheets("SCADENZIARIO").Range("A1")
Application.CutCopyMode = False
dataWB.Close False
Sheets(strListSheet).Select
Exit Sub
謝謝! 我真的應該注意到了。 – gorion83