我试图使用工作簿A的一些输入从工作簿B获取数据库以进行自动过滤。我正在工作簿A中构建宏。
我有以下内容: 工作簿A-您开始工作时的文件 Worrkbook B-数据库,此代码的最终目标是将一些信息从工作簿B导入到工作簿A
我需要以下内容:
该过程应连续重复几次。
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim input_row, input_column As Integer
Dim input_db As String
Dim wbB, wbA As Workbooks
If Not (Application.Intersect(ActiveCell, [Links]) Is Nothing) Then 'Links is the name of the range where I need the code to be active
If ActiveCell.Value <> "" Then
input_row = ActiveCell.row
input_column = ActiveCell.Column
input_db = ActiveCell.Value
Set database = Workbooks.Open("Workbook B location")
ActiveWorkbook.ActiveSheet.Range("A9").AutoFilter Field:=1, Criteria:=input_db ' This bit doesnt work as expected
End If
End If
End Sub