![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 53
|
I have already posted this topic but without success. I live in Ireland where the date format is dd/mm/yy
I am using an inputbox in vba to insert a date in an excel sheet as part of a procedure. My Regional settings are dd/mm/yy. The column in excel is formatted dd/mm/yy but when I use the input box as dd/mm/yy the date appears on the sheet as mm/dd/yy. If it is entered as 10/May/02 it will return 10/05/02. But entered as 10/05/02 will return 5/10/02. Any help would be greatly appreciated |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Sub tester() Dim dDate dDate = Format(InputBox("Enter date"), "dd/mm/yy") With [Sheet1] .[A1] = dDate .[A1].NumberFormat = ("dd/mm/yy") End With End Sub |
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Hi,
Here's a quick example for you, just open a new workbook and use the code, it saves you renaming the "Sheet1" part:
This should work because my regional settings are set as US. (i.e. with the retarded version of the date format. I mean, even the military here uses dd/mm/yy) HTH |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Ah, we meet again Mr. Moala.
Why is it that we post variations on the same theme, but seldom use the same techniques? |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
I only bet you y 1 minute....usually don't
post when your online..diff time zone but it's after 3:00 am in the morning here.... only enought time for a few more Q's. |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: May 2002
Posts: 53
|
Thank you Ivan and Mark. Both of your solutions worked perfectly. Keep up the good work. I hope I can answer a queery myself some day.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|