I hope that that is not too tall an order.
Thank you
Brian
This is a bit raw but could be helpful.
Regards
Asim
File Attached: http://www.exceltip.com/forum/attachment.php?postid=260847 (sheetstest.xls)
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/
Option Explicit
Sub auto_close()
On Error Resume Next
Application.CommandBars("MyNavigator").Delete
On Error GoTo 0
End Sub
Sub auto_open()
Dim cb As CommandBar
Dim ctrl As CommandBarControl
Dim wks As Worksheet
On Error Resume Next
Application.CommandBars("MyNavigator").Delete
On Error GoTo 0
Set cb = Application.CommandBars.Add(Name:="myNavigator", temporary:=True)
With cb
.Visible = True
Set ctrl = .Controls.Add(Type:=msoControlButton, temporary:=True)
With ctrl
.Style = msoButtonCaption
.Caption = "Refresh Worksheet List"
.OnAction = ThisWorkbook.Name & "!refreshthesheets"
End With
Set ctrl = .Controls.Add(Type:=msoControlComboBox, temporary:=True)
With ctrl
.AddItem "Click Refresh First"
.OnAction = ThisWorkbook.Name & "!changethesheet"
.Tag = "__wksnames__"
End With
End With
End Sub
Sub ChangeTheSheet()
Dim myWksName As String
Dim wks As Worksheet
With Application.CommandBars.ActionControl
myWksName = .List(.ListIndex)
End With
Set wks = Nothing
On Error Resume Next
Set wks = Worksheets(myWksName)
On Error GoTo 0
If wks Is Nothing Then
Call refreshthesheets
MsgBox "Please try again"
Else
wks.Select
End If
End Sub
Sub refreshthesheets()
Dim ctrl As CommandBarControl
Dim wks As Worksheet
Set ctrl = Application.CommandBars("myNavigator") _
.FindControl(Tag:="__wksnames__")
ctrl.Clear
For Each wks In ActiveWorkbook.Worksheets
ctrl.AddItem wks.Name
Next wks
End Sub
If you add a worksheet or change workbooks, just click on the "refresh" button,
then use the dropdown.
--
Dave Peterson
ec3...@msn.com