Dialogue Box to populate several instances

S

solomon_monkey

Morning,

I would very much like a dialogue box to pop up and prompt the user to
insert a three digit number so as to populate cell A1 and the Worksheet
with the letter 'X' and the three digit code entered.
Any easy ideas?

Thanks

Solomon
 
P

Paul B

Solomon, try something like this

Range("A1").Value = "x " & InputBox("Enter Your 3 digit number", _
"Enter Number")

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
S

Sharad

Not really sure what exactly you want to populate or what multiple
instances you are talking about.
However below example, should give you an idea how to achieve what you
want to achieve:

Where to put this code? Well you did not mention when you want the
dialgoue box to pop up.
Try it in Workbook_Open event.

Sharad

Dim resp As String, ShExists As Boolean, Sh As Worksheet
Getnum:
resp = InputBox("Please enter a 3 digit number (Integer Only)")
If Len(resp) = 0 Then Exit Sub
If Not IsNumeric(resp) Then
MsgBox "Please enter an Integer!", vbCritical, "Data type error"
GoTo Getnum:
End If
If InStr(1, resp, ".") > 0 Or InStr(1, resp, ",") > 0 Then
MsgBox "Integer Only please! No decimal point or commas", _
vbCritical, "Data type error"
GoTo Getnum:
End If
If Len(resp) <> 3 Then
MsgBox "The number MUST BE THREE DIGITS!", vbCritical, "Digits
error"
GoTo Getnum
End If
ShExists = False
For Each Sh In ThisWorkbook.Worksheets
If Sh.Name = "X" & resp Then
ShExists = True
End If
Next Sh
If Not ShExists Then
MsgBox "There is no sheet in this workbook relating to the
number you entered." _
& Chr(13) & "Please try with different number", vbCritical,
"Sheet Not Found"
GoTo Getnum:
End If

Worksheets("X" & resp).Range("A1").Value = "Whatever value you want
to put"
 
B

Bob Phillips

M orning Solomon,

Do
val = InputBox("Supply 3 digit number")
fOK = val = "" Or (IsNumeric(val) And val > 0 And val < 1000)
If fOK And val <> "" Then Range("A1").Value = val
Loop Until fOK


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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