• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

macro to set current workbook as variable and set as active later

theath

New Member
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
 
Wow, that was simple! Thanks for the help. I added this to the full script I was working on and it works like a charm!!


Thanks Hui!
 
Back
Top