Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default excel input date format

Hi
Thanks in advance for any help.
I have this small macro
Dim myDateP1
myDateP1 = InputBox("Enter START date for report PERIOD in dd-mm-yy
format")
If myDateP1 < "" Then
If IsDate(myDateP1) Then
' MsgBox "Continue the macro"
' Selection.NumberFormat = "dd/mm/yyyy"
' ActiveCell.Offset(0, 2).Range("A1").Select
Selection.FormulaR1C1 = myDateP1
Range("n4").Select
Selection.FormulaR1C1 = "=(r[-3]c)"
' Selection.NumberFormat = "dd/mm/yyyy"
Else
MsgBox "You did not enter a date"
End If
End If

seeking the user to input a date, in the format dd/mm/yy This part work.
However when the date is placed into the cell the format becomes mm/dd/yy.

I know I'm doing something wrong and it might be the new year blues.

Is anyone able to guide me. as you can see by the rem I've tryied formating
the cells.

Thanks
Noel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default excel input date format

Noel,

Change

Selection.FormulaR1C1 = myDateP1

to

Selection.FormulaR1C1 = CDate(myDateP1)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"NoelH" wrote in message
...
Hi
Thanks in advance for any help.
I have this small macro
Dim myDateP1
myDateP1 = InputBox("Enter START date for report PERIOD in

dd-mm-yy
format")
If myDateP1 < "" Then
If IsDate(myDateP1) Then
' MsgBox "Continue the macro"
' Selection.NumberFormat = "dd/mm/yyyy"
' ActiveCell.Offset(0, 2).Range("A1").Select
Selection.FormulaR1C1 = myDateP1
Range("n4").Select
Selection.FormulaR1C1 = "=(r[-3]c)"
' Selection.NumberFormat = "dd/mm/yyyy"
Else
MsgBox "You did not enter a date"
End If
End If

seeking the user to input a date, in the format dd/mm/yy This part work.
However when the date is placed into the cell the format becomes mm/dd/yy.

I know I'm doing something wrong and it might be the new year blues.

Is anyone able to guide me. as you can see by the rem I've tryied

formating
the cells.

Thanks
Noel



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
Date input format Roy Gudgeon[_2_] Excel Discussion (Misc queries) 2 May 20th 10 02:05 PM
How do I change dates input as 20080426 to date format in Excel? Judy CS Excel Discussion (Misc queries) 7 May 8th 08 03:19 PM
need help with a conditional format in regards to "date" input Fritter Excel Discussion (Misc queries) 1 September 25th 07 02:40 AM
Input Box Help - Validate Date Format Tbal[_5_] Excel Programming 1 September 6th 05 09:13 PM
Excel 97, text box Input Mask, local date format Kevin McCartney Excel Programming 3 November 9th 04 08:23 PM


All times are GMT +1. The time now is 04:00 AM.

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"