#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date Format


Dear all,

Win local format is "dd/mm/yy"

in VBA

Cells(1, 1) = "08/02/2006"

in Excel sheet display

"02/08/06" in A1

What happen?


--
gabch
------------------------------------------------------------------------
gabch's Profile: http://www.excelforum.com/member.php...o&userid=30662
View this thread: http://www.excelforum.com/showthread...hreadid=536337

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Date Format

Hi Gabch,

Try:

Cells(1, 1).Value = DateValue("08/02/2006")


---
Regards,
Norman



"gabch" wrote in
message ...

Dear all,

Win local format is "dd/mm/yy"

in VBA

Cells(1, 1) = "08/02/2006"

in Excel sheet display

"02/08/06" in A1

What happen?


--
gabch
------------------------------------------------------------------------
gabch's Profile:
http://www.excelforum.com/member.php...o&userid=30662
View this thread: http://www.excelforum.com/showthread...hreadid=536337



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Date Format

The Windows Regional Settings dictates, among other things, how Excel should
present dates.

However, the VBA code is primarily using US format for dates. Hence,
Cells(1, 1) = "08/02/2006" means 02-Aug-2006 (US mm/dd/yyy), and it then gets
translated into "02/08/2006" (which means 02-Aug-2006 in your UK format)
during the presentation stage, i.e., when Excel displays the date in cell A1.

By the way, you can also use the following construct in the futu

Cells(1, 1) = #2/8/2006#

The #..# literal is explicitly of type Date (and, yes, it's in US format) so
you know what you'll get. A string, however, can basically be anything you
like...

Cheers,
/MP

"gabch" wrote:


Dear all,

Win local format is "dd/mm/yy"

in VBA

Cells(1, 1) = "08/02/2006"

in Excel sheet display

"02/08/06" in A1

What happen?


--
gabch
------------------------------------------------------------------------
gabch's Profile: http://www.excelforum.com/member.php...o&userid=30662
View this thread: http://www.excelforum.com/showthread...hreadid=536337


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Date Format


Hi,

How can I convert UK date format(dd/mm/yy) at cell to US format
(mm/dd/yy) through VBA


--
gabch
------------------------------------------------------------------------
gabch's Profile: http://www.excelforum.com/member.php...o&userid=30662
View this thread: http://www.excelforum.com/showthread...hreadid=536337

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
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
Convert european foreign date format to US date format EAL Excel Worksheet Functions 1 May 14th 09 10:02 PM
Excel 2000 date format cannot be set to Australian date format Brian Jones Excel Discussion (Misc queries) 1 March 30th 05 06:03 AM
code to convert date from TEXT format (03-02) to DATE format (200203) Gauthier[_2_] Excel Programming 0 September 22nd 04 03:26 PM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


All times are GMT +1. The time now is 11:44 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"