Hi,
i am currently dealing with an excel with more than 90 sheets. Hence i am trying to write a macro for users to go to the sheet they want from the main page. I have thought of using a textbox and a macro.
private sub commandbutton1_click()
rname = TextBox1.Text
if rname="",Then GoTo ErrHandler :
On Error GoTo Errhandler:
If rname = "sheet1" Then
worksheets("sheet1").Activate
Else
If rname = "sheet2" Then
worksheets("sheet2").Activate
Else
If (continues to the last sheet, >90 sheets)
End If
End If
End If
....
GoTo Lastline
ErrHandler:
MsgBox ("Invalid name, please try again")
Lastline:
End Sub
This is very troublesome, hence i am hoping if any1 knows a shorter/easier coding.something similar to the code below
private sub commandbutton_click()
rname=textbox1.text
if rname = ""then GoTo ErrHandler:
On Error GoTo ErrHandler:
worksheets("rname").Activate
GoTo Lastline:
ErrHandler:
MsgBox ("Invalid name, please try again")
Lastline:
End Sub
Thank you
Bookmarks