Handy worksheet navigation dropdown box for those annoying multi-worksheet workbooks
Ribbon Code
PHP
<!--RibbonX Visual Designer 2.31 for Microsoft Excel CustomUI14 XML Code produced on 2016/11/25-->
<customUI Onload="RibbonOnLoad" xmlns="http://schemas.microsoft.com/office/2009/07/customui" >
<ribbon >
<tabs >
<tab
id="Tab1"
insertBeforeMso="TabHome"
label="My Menu">
<group
id="grpDropDowns"
label="Worksheet Navigation">
<dropDown
id="SheetNavigation"
label="Navigate to:"
sizeString="WWWWWWWWWW"
supertip="Go to Worksheet Selected in Dropdown "
getItemCount="getItemCount"
getItemLabel="getItemLabel"
getSelectedItemIndex="GetSelectedItemIndexDropDown"
onAction="onAction"/>
</group >
</tab >
</tabs >
</ribbon >
</customUI >
Display More
In module vba
Code
Option Explicit
Dim Rib As IRibbonUI
Private mwkbNavigation As Workbook
Sub getItemCount(control As IRibbonControl, ByRef returnedVal)
Dim lCount As Long
Dim wksSheet As Worksheet
Set mwkbNavigation = ThisWorkbook
For Each wksSheet In mwkbNavigation.Worksheets
If wksSheet.visible = xlSheetVisible Then
lCount = lCount + 1
End If
Next wksSheet
returnedVal = lCount
End Sub
Sub GetSelectedItemIndexDropDown(control As IRibbonControl, ByRef index)
index = ActiveSheet.index - 1
End Sub
Sub getItemLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
If mwkbNavigation.Worksheets(index + 1).visible = xlSheetVisible Then
returnedVal = mwkbNavigation.Worksheets(index + 1).Name
End If
End Sub
Sub onAction(control As IRibbonControl, id As String, index As Integer)
Dim sSheetName As String
sSheetName = mwkbNavigation.Worksheets(index + 1).Name
mwkbNavigation.Worksheets(sSheetName).Activate
End Sub
Sub RibbonOnLoad(ribbon As IRibbonUI)
Set Rib = ribbon
End Sub
Display More