I'm trying to use a listbox to find and select certain sheets in my workbook. I've made a userform with following code:
Private Sub UserForm_Initialize()
Dim objSheet As Object
CommandButton1.Caption = "Ok"
CommandButton2.Caption = "Cancel"
With frmOle.ListBox1
For Each Item In Sheets
.AddItem Item.Name
Next
.Selected(0) = True
.SetFocus
End With
End Sub
How do I go forward to make the selected item in the listbox
activate and show the correct sheet, and further is it possible to "hide" certain sheets from the listbox (not selectable sheets). (I have multipple sheets and amount of sheets in the workbook is not static but increases).
Please help, and thx in advance
Regards OleM
Private Sub UserForm_Initialize()
Dim objSheet As Object
CommandButton1.Caption = "Ok"
CommandButton2.Caption = "Cancel"
With frmOle.ListBox1
For Each Item In Sheets
.AddItem Item.Name
Next
.Selected(0) = True
.SetFocus
End With
End Sub
How do I go forward to make the selected item in the listbox
activate and show the correct sheet, and further is it possible to "hide" certain sheets from the listbox (not selectable sheets). (I have multipple sheets and amount of sheets in the workbook is not static but increases).
Please help, and thx in advance
Regards OleM