Saturday, March 27, 2010

Toggle between multiple excels sheets using Macro

Ok... let me explain you how to toggle between multiple screens in Excel using Macros.

Dim WB,WB1 as workbook
Dim WS,WS1 as worksheet

Set WB=Activeworkbook
Set WS=Activeworkbook.sheeets("Sheet1")

Workbooks.open("New excel wb name.xls")

Set WB1=Activeworkbook
Set WS1=Activeworkbook.sheets("Sheet2")

Now you are working with the second excel wb, and if you wish to toggle to the first workbook

use the below code

WB.Activate
WS.select

and if you require to toggle back to the 2nd workbook....

WB1.Activate
WS1.select

.... Happy Coding :)

No comments:

Post a Comment