Try something like;
On Error Resume Next
TryAgain:
WorksheetName = InputBox("Enter name of Worksheet")
If WorksheetName = "" Then Exit Sub
Sheets(WorksheetName).Select
If Err Then: Err.Clear: GoTo TryAgain
Ivan
Hi Eli,
You could also use a listbox with the names of the sheets. Use some code like this :
Sub SelectSheet()
For Each ws In ThisWorkbook.Sheets
UserForm1.ListBox1.AddItem ws.Name
Next
UserForm1.Show
Sheets(UserForm1.ListBox1.Value).Select
End Sub
Bruno
-----
I tried your code but there is an error
No. 424 Object required
Thank you
Eli
Hi Eli,
I know i've given just the information to get started...
What need at least is :
a) an userform called userform1
with on this userform :
b) a listbox called listbox1
c) a commandbutton, caption "OK"
d) a commandbutton, caption "Cancel"
dubbleclick on the OK button and enter the following code :
Private Sub cmdOK_Click()
Me.Hide
End Sub
dubbleclick on the OK button and enter the following code :
Private Sub cmdAnnuleren_Click()
End
End Sub
maybe it's easier if I send you my xls file...
just let me know your e-mail adress.
Bruno
-----
Sub SelectSheet()
For Each ws In ThisWorkbook.Sheets
UserForm1.ListBox1.AddItem ws.Name
Next
UserForm1.Show
Sheets(UserForm1.ListBox1.Value).Select
End