ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Navigate Sheets - better way. (https://www.excelbanter.com/excel-programming/338606-navigate-sheets-better-way.html)

Doug929

Navigate Sheets - better way.
 
I want to navigate from one sheet to the other. Is there a better way then
this....

' Go back and format previous sheet.
Sheets(Worksheets.Count - 1).Select
' Format sheet.
Call SB2_Format
' Come back and start again.
Sheets(Worksheets.Count).Select



Tom Ogilvy

Navigate Sheets - better way.
 
activesheet.previous.select
SB2_Format
ActiveSheet.Next.Select

Not sure if it makes any difference.

Another approach would be to modify SB2_format so you can pass a sheet
reference to it and it can format that sheet without activating it.
then the code could just be

set sh = Activesheet.Prevous
SB2_Format sh
--
Regards,
Tom Ogilvy

"Doug929" wrote in message
...
I want to navigate from one sheet to the other. Is there a better way then
this....

' Go back and format previous sheet.
Sheets(Worksheets.Count - 1).Select
' Format sheet.
Call SB2_Format
' Come back and start again.
Sheets(Worksheets.Count).Select





Doug929

Navigate Sheets - better way.
 
Thanks Tom, you have been helping for years! I appreciate it.

"Tom Ogilvy" wrote:

activesheet.previous.select
SB2_Format
ActiveSheet.Next.Select

Not sure if it makes any difference.

Another approach would be to modify SB2_format so you can pass a sheet
reference to it and it can format that sheet without activating it.
then the code could just be

set sh = Activesheet.Prevous
SB2_Format sh
--
Regards,
Tom Ogilvy

"Doug929" wrote in message
...
I want to navigate from one sheet to the other. Is there a better way then
this....

' Go back and format previous sheet.
Sheets(Worksheets.Count - 1).Select
' Format sheet.
Call SB2_Format
' Come back and start again.
Sheets(Worksheets.Count).Select







All times are GMT +1. The time now is 08:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com