Goto next visible worksheet
What macro command would I include tied to a button to go to the next
visible worksheet? |
Goto next visible worksheet
Before or after the current one?
The keyboard commands use Ctrl+Page Up and Ctrl+Page Down. Record these, using the macro recorder, and you've got your code. -- Andy Wiggins FCCA www.BygSoftware.com Excel, Access and VBA Consultancy - "Kent McPherson" wrote in message ... What macro command would I include tied to a button to go to the next visible worksheet? |
Goto next visible worksheet
Assuming the button is on the ActiveSheet:
Private Sub CommandButton1_Click() Dim i As Integer Dim intStart As Integer intStart = ActiveSheet.Index + 1 For i = intStart To Worksheets.Count If Not Worksheets(i).Visible = xlHidden Then 'Note: Could add "and Worksheets(i).Visible = xlVeryHidden to above Worksheets(i).Activate Exit Sub End If Next i End Sub "Kent McPherson" wrote: What macro command would I include tied to a button to go to the next visible worksheet? |
All times are GMT +1. The time now is 09:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com