Macro Help


Posted by Mark Kennedy on January 17, 2002 11:19 AM

Hello-
I want to add a snippet of code to an existing macro that will take me back to my original sheet. My macro makes some changes and ends up on a new sheet. I want it to take me back to whatever sheet I was on when I envoked the macro.
I know this has to be so simple. I just don't have time to do it.
Any help would be greatly appreciated.
Thanks,
Mark

Posted by Dan on January 17, 2002 11:38 AM

At the beginning of your macro put:
WorkbookName = ActiveWorkbook.Name

at the end put:
Windows(WorkbookName).Activate

that should work for you...HTH

Posted by Dan on January 17, 2002 12:03 PM

Almost forgot to tell you to declare the WorkbookName variable as a String first.

Dim WorkbookName as String

Posted by Mark on January 17, 2002 12:26 PM



Posted by Mark on January 17, 2002 12:27 PM

That's it! Thanks for your help! This is the first time I've used this site. What an awesome resource! I'll be back.