by any chance lets say i have only 2 workbooks open, if i'm working in one, is there any command or anything that says select the other workbook open, so that i can just switch between them, thanks!
The best way to deal with this is to have a workbook object variable for each of the two workbooks, for example:
dim wb1 as workbook, wb2 as workbook
set wb1=activeworkbook
workbooks.add
set wb2=activeworkbook
wb1.activate
'do stuff in the original workbook
wb2.activate
'do stuff in the new workbook
You can certainly say
workbooks(1).activate and workbooks(2).activate, but this depends on there being just two workbooks open, and isn't particularly robust. Rob
The following sub will select the next sheet, and go back to the first after it hits the last sheet. You'll have to do additional testing if you have hidden sheets.
sub ActivateNextSheet
if activesheet.index=activeworkbook.sheets.count then
sheets(1).activate
else
sheets(activesheet.index+1).activate
end if
end sub Rob
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.