Hello!
I am new to VBA and having trouble using a variable to run a macro in another sheet. The macro I'm trying to run is called "bride". It copies a range in a sheet that I want to paste in my active sheet. When I try to run the code below, I get a syntax error for the "Application.Run" command and I haven't been able to figure out what I'm doing wrong after much trial and error! I also tried defining the "copyWB" variable as a workbook, but couldn't get that to work either.
Thanks for any help!
I am new to VBA and having trouble using a variable to run a macro in another sheet. The macro I'm trying to run is called "bride". It copies a range in a sheet that I want to paste in my active sheet. When I try to run the code below, I get a syntax error for the "Application.Run" command and I haven't been able to figure out what I'm doing wrong after much trial and error! I also tried defining the "copyWB" variable as a workbook, but couldn't get that to work either.
Thanks for any help!
Code:
Sub copypaste_master()
Dim copyWB As String
copyWB = "Schedule Engine_v0.29_with macro_V3.xlsm"
Dim pasteWB As Workbook
Set pasteWB = ThisWorkbook
Workbooks(copyWB).Activate
Application.Run copyWB&"!bride"
pasteWB.Activate
Worksheets("Sheet1").Activate
ActiveSheet.Range("D5").Select
ActiveSheet.Paste
End Sub