Help modify simple existing code??

  • Thread starter Thread starter ali
  • Start date Start date
A

ali

I've been using the following code to bring up 2 input boxes, 1 afte
the other, to allow the user to enter data into cells i'v
pre-determined.

Range("g3").Value = InputBox("Enter Your Initials")
Range("h3").Value = InputBox("Enter Today's Date")


However, in an ideal world (or an ideal forum!) I'd like only one inpu
box to pop up with two fields, initials and date, instead of the two a
at present.

Can anyone help please? Many thank
 
How about
Range("g3").Value = InputBox("Enter Your Initials")
Range("h3").Value = InputBox("Enter Today's Date")

Range("g3").Value = InputBox("Enter Your Initials in TWO letter format")
Range("h3") = date
 
If you really want to use an InputBox, then you could ask the user to
separate the initials and todays date with a delimiter of some sort. eg
semi-colon.

If you think that at some point in the future you may be asking for more
than those two entries, you may want to create a userform.
 
Create your custom Input form. Insert 2 textboxes and 2
labels and 2 buttons (OK, CANCEL).
Label1.Caption = "Enter Your Initials"
TextBox1.Text = ""
Label2.Caption = "Enter Today's Date"
TextBox2.Text = Format(Date,"mmmm, dd yyyy")

Private Sub CmdOK_Click()

If Me.TextBox1 = "" Or Me.TextBox2 = "" Then
MsgBox "I need all data", vbExclamation, "Info..."
Exit Sub
End if

With ThisWorkbook.Worksheets("Name")
.Range("g3").Value = Me.TextBox1
.Range("h3").Value = Me.TextBox2
End with

Unload Me

End Sub

Private Sub CmdCancel_Click()
Unload Me
End Sub
 
Thanks guys, an input box sounds like the way i want to go but i've
never created one of those before - would any of you be willing to
talk(type!) me through the way to create one with reference to what i
want to create - preferably explaining things in idiot proof english
along the way?

Once again your help is much appreciated
 
Your OP said that "i am using the following code". I made a suggestion to
modify to suit your question. What is it you don't know how to do?
 
Don,

Many apologies, i am clearly suffering from very tired eye syndrome and
messed up when i first tried your way. Thanks for taking the time to
help
 
Back
Top