I have FirstWB.xlsm which stores macros, and open a target workbook to run a macro stored on FirstWB.xlsm.
One thing about the macro is that, the target workbook and macro to be used are based on cell reference in L1 and L2 respectively.
The following are my codes
I am missing the code to refer macro to run on target workbook, which the code currently runs on FirstWB.xlsm where it stores macro.
Any ideas?
One thing about the macro is that, the target workbook and macro to be used are based on cell reference in L1 and L2 respectively.
The following are my codes
Sub test()
Dim SecondWB As String
Dim MacroName As String
Dim wb_macro As Workbook
Dim wb_target As Workbook
SecondWB = Range("L1").Value
Set wb_target = Workbooks.Open(SecondWB)
Set wb_macro = Workbooks.Open("PathTOFirstWB\FirstWB.xlsm")
Application.Run "'" & wb_macro.Name & "'!" & Range("L2").Value
End Sub
I am missing the code to refer macro to run on target workbook, which the code currently runs on FirstWB.xlsm where it stores macro.
Any ideas?