create msg box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Can anybody offer some code (as I'm new to this) to alow the user to input a
name into a msg box and then search and display the corrct worksheet with
that name.
I thank you!
 
Anthony

one way:

Sub ActivateSheet()
Dim sSheetName As String
sSheetName = InputBox("Input Sheet Name", "Sheet Name", "Sheet1")
If sSheetName = "" Then Exit Sub
On Error Resume Next
Sheets(sSheetName).Select
On Error GoTo 0
End Sub

Regards

Trevor
 
thanks Trevor - I'll give that a try

Trevor Shuttleworth said:
Anthony

one way:

Sub ActivateSheet()
Dim sSheetName As String
sSheetName = InputBox("Input Sheet Name", "Sheet Name", "Sheet1")
If sSheetName = "" Then Exit Sub
On Error Resume Next
Sheets(sSheetName).Select
On Error GoTo 0
End Sub

Regards

Trevor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top