このコードはローカル Workbook で完全に機能しますが、Personal.xlsb ファイルで機能させる方法がわかりません (また、SOF でいくつかの提案を試みました)。どんな助けでも大歓迎です。
'このマクロはローカルで動作します - Personal.xlsb レベルで動作させる必要があります
'This macro works locally - need to get it to work at the Personal.xlsb level
Sub AdvLookupVals()
Dim colA_Range As Range
Dim rngLookupRange As Range
Dim rngFoundRange As Range
Dim wb As Workbook
ThisWorkbook.Worksheets("Sheet1").Activate
'when you do this, Lookup.xls becomes active and sets the range
Set wb = Workbooks.Open("C:\Lists\Resource_Lookup.xlsx", True, True) ' open the source workbook, read only
Set rngLookupRange = wb.Worksheets("Sheet1").Range("A1:A656")
'Makes target workbook active again
ThisWorkbook.Activate
'Set rngFoundRange = wb.Worksheets("Sheet1").Range("A1:A653")
'rngFoundRange.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= '_ 'hoping this would make the macro work in Personal.xlsb
Range("A1:A653").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
rngLookupRange, Unique:=False 'rngLookupRange gets the criteria from above. .filters by name.
'releases resources back to the system and close the other workbook
Set rngLookupRange = Nothing
wb.Close False ' close the source workbook without saving any changes
Set wb = Nothing ' frees memory
End Sub