Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jon Jon is offline
external usenet poster
 
Posts: 183
Default Dates from InputBox

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Dates from InputBox

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

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

Ross


"Jon" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
Jon Jon is offline
external usenet poster
 
Posts: 183
Default Dates from InputBox

Ross-Thanks! Only 1 minor adjustment

dim newrecDate As Date

Thanks again-
Jon

"Ross Culver" wrote:

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

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

Ross


"Jon" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to enter dates in Excel cells using InputBox dilettante Excel Programming 2 October 3rd 06 02:53 PM
InputBox requesting dates between two predefined dates Barb Reinhardt Excel Programming 2 January 20th 06 09:45 PM
How do I get dates into an inputbox ? Sfekke Excel Programming 1 November 24th 05 08:32 AM
Entering dates in vba inputbox as ddmmyy. Excel returns mmddyy pkeegs Excel Programming 3 August 30th 05 08:57 AM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM


All times are GMT +1. The time now is 01:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"