PC Review


Reply
Thread Tools Rate Thread

Dates from InputBox

 
 
=?Utf-8?B?Sm9u?=
Guest
Posts: n/a
 
      3rd Oct 2007
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 With Quote
 
 
 
 
Ross Culver
Guest
Posts: n/a
 
      3rd Oct 2007
Jon,
dim newrecDate = date
newrecDate = InputBox(Prompt, Caption)
Range("A1") = newrecDate

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

Ross


"Jon" <(E-Mail Removed)> wrote in message
news:7459A139-6F20-4384-9E90-(E-Mail Removed)...
> 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 With Quote
 
=?Utf-8?B?Sm9u?=
Guest
Posts: n/a
 
      4th Oct 2007
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" <(E-Mail Removed)> wrote in message
> news:7459A139-6F20-4384-9E90-(E-Mail Removed)...
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to enter dates in Excel cells using InputBox =?Utf-8?B?ZGlsZXR0YW50ZQ==?= Microsoft Excel Programming 2 3rd Oct 2006 02:53 PM
InputBox requesting dates between two predefined dates =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Excel Programming 2 20th Jan 2006 09:45 PM
Re: How do I get dates into an inputbox ? Nick Hodge Microsoft Excel Programming 0 24th Nov 2005 08:32 AM
Inputbox and Application.InputBox Maria Microsoft Excel Programming 1 20th Sep 2004 11:36 AM
InputBox Benoit Microsoft Excel Misc 2 22nd Oct 2003 04:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:54 AM.