Macro to create a shortcut to make next Worksheet visible
Hello,
I am looking for a macro that will make the worksheet to the right of the active worksheet visible, thus enhancing the navigatiuon through the excel workbook. Once the last worksheet on the right is reached the I will start again at the first one. Actually I am looking at the same behavior than the Alt + Tab keys combination in Windows. Has anyone done this. Thanks, nde |
Macro to create a shortcut to make next Worksheet visible
activesheet.next.Activate
You would have to check that the activesheet is not the last sheet and also pay attention to hidden sheets. Also look at the previous command. -- Regards, Tom Ogilvy "nde" wrote: Hello, I am looking for a macro that will make the worksheet to the right of the active worksheet visible, thus enhancing the navigatiuon through the excel workbook. Once the last worksheet on the right is reached the I will start again at the first one. Actually I am looking at the same behavior than the Alt + Tab keys combination in Windows. Has anyone done this. Thanks, nde |
Macro to create a shortcut to make next Worksheet visible
Ctrl+Page Up or Page Down
That will switch between tabs similar to the way Alt+Tab switches between windows. You may also try something like this: Sub test() c = ActiveSheet.Index If c = Sheets.Count _ Then MsgBox ("You have reached the last sheet.") End Else End If With Sheets(c + 1) .Visible = True .Activate End With End Sub HTH, Paul "nde" wrote in message ... Hello, I am looking for a macro that will make the worksheet to the right of the active worksheet visible, thus enhancing the navigatiuon through the excel workbook. Once the last worksheet on the right is reached the I will start again at the first one. Actually I am looking at the same behavior than the Alt + Tab keys combination in Windows. Has anyone done this. Thanks, nde |
Macro to create a shortcut to make next Worksheet visible
nde,
try something like this Sub SheetAct() Dim x As Integer x = ActiveSheet.Index Do If x < Worksheets.Count Then x = x + 1 Else x = 1 End If Loop Until Worksheets(x).Visible = True Worksheets(x).Activate End Sub regards, DaveU |
All times are GMT +1. The time now is 04:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com