I need help with a macro. When I run the macro, I need to set the current workbook as a variable. I want to then call that variable later.
Here is what I have and it doesn't work. I have two workbooks open. If I name them in the macro I can see it switc focus to each one. If I try to pass in a variable name, I get errors. Any ideas?
Sub switchWorkbook()
Dim WB As Workbook
Set WB = ThisWorkbook
Windows("FEB PROJECT REPORT.CSV").Activate
Windows(WB).Activate
End Sub
Here is what I have and it doesn't work. I have two workbooks open. If I name them in the macro I can see it switc focus to each one. If I try to pass in a variable name, I get errors. Any ideas?
Sub switchWorkbook()
Dim WB As Workbook
Set WB = ThisWorkbook
Windows("FEB PROJECT REPORT.CSV").Activate
Windows(WB).Activate
End Sub