Input box data check

M

Mark

Hello everyone,
I'm trying to create an input box that woulk ask for a worksheet name, which
is one of a hundred worksheets. If the name is incorrect or a name is not
given then a msg box would come up and repeat the request again. After 3
times a file will appear to assist the user. How can I resolve this. Thanks.
 
D

Don Guillett

Maybe use a drop down with a list of the sheets.
http://www.contextures.com/tiptech.html

Or, a worksheet_double click event to goto the sheet where the name is in a
cell. Make a list using a macro.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Application.DisplayAlerts = False
Dim WantedSheet As String
WantedSheet = Trim(ActiveCell.Value)
If WantedSheet = "" Then Exit Sub
On Error Resume Next
If Sheets(WantedSheet) Is Nothing Then
GetWorkbook ' calls another macro to do that
Else
Application.GoTo Sheets(WantedSheet).Range("a4")
End If
Application.DisplayAlerts = True
End Sub
 
M

Mark

Hey Don thanks. I just got back on and noticed your reply.
I did put the following together but it doesn't answer everything that I
need. i will check yours out. Here's what I put together:
For Each ws in Worksheets
If ws.Name = Inputdata Then
ws.Activate
Exit Sub
End If
Next
 
D

Don Guillett

This sub will made a list of your activeworkbook sheets in col A. Then you
can use my doubleclick

Sub listsheets()
For i = 1 To Sheets.Count
Cells(i, "a") = Sheets(i).Name
Next i
End Sub
 
M

Mark

Hey Don,

Just got back from the holidays. I ran your routine and it works great,
thanks. Is there a book I could get to help me on VBA in Excel (one that has
lots of examples)?
Again thanks.
 

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

Top