Add Second Input Box

tlc53

Active Member
Joined
Jul 26, 2018
Messages
399
Hi,

Can someone help me with this please? Originally I was having trouble with entering a date in the input box, but that now works really well.
Now I want to add another input box which asks for the user name (see last 2x lines of code below. This part isn't working or looking right. I wouldn't mind if both input boxes came up at the same time, if possible/easy enough to do..

VBA Code:
Private Sub Post_Journal()
 Dim StartDate As Date
 Dim MsgDate As String
 Dim TitleDate As String
 Dim response As String
 
 MsgDate = "Enter date journal posted (d/mm/yy)"
    TitleMsg = "Journal Post Date"
 
curdate = Date

StartDate = Application.InputBox(MsgDate, TitleMsg, FormatDateTime(curdate, vbShortDate), Type:=1)

Range("Z2").Value = StartDate

reponse = InputBox("Enter User Name")
Range("Z1").Value = response

End Sub

Thank you!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Ok.
But in your last post you said:
enter date - enter user name
But you asked for Date and Range(A1) value
So do you have what you want now

So if you always want user to enter Todays Date
Why need a Input Box Why not just have the script automatically enter Todays date.
And if always enter UserName why not have the script automatically do this with no need for any Input boxes.
Usually it will be today's date but not always. They may not recognise that they've posted the journal, until the following day for example.
The person posting the journal will mostly always be the user of the spreadsheet (A1) but not necessarily all the time. Someone may do a journal on their behalf (senior authority for example).
Yes, I have everything I need now. Thanks again!
 
Upvote 0
Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top