Dates from InputBox

G

Guest

Hello,
I am having a problem with the following code. When the user inputs the date
in mm/dd/yyyy format in the inputbox, it gets converted into a number (9 for
example) and displays 1/8/1900 in the cell. Could someone suggest how to
force the inputbox to use the needed date format?
Jon

Private Sub Workbook_Open()
aDate = Range("A1").Value
Ans = MsgBox("Is " & aDate & " the correct reconciliation date?",
vbYesNo, "Question...")
Select Case Ans
Case vbYes
Exit Sub
Case vbNo
Prompt = "What is the new reconciliation date?"
Caption = "Tell me..."
newrecDate = Val(InputBox(Prompt, Caption))
Range("A1") = newDate
End Select
End Sub
 
R

Ross Culver

Jon,
dim newrecDate = date
newrecDate = InputBox(Prompt, Caption)
Range("A1") = newrecDate

I assume range("A1") is formatted for dates.

Ross
 

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