ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dates Being displayed the wrong way around. (https://www.excelbanter.com/excel-programming/409287-dates-being-displayed-wrong-way-around.html)

NateBuckley

Dates Being displayed the wrong way around.
 
Hello, Everyone.

I'm having more problems with dates, I'm reading in dates from a
Spreadsheet, and it's swtiching the day and the month around

so the format should be DD/MM/YY (If the order appears Alien it's because
i'm from from the UK )

In my spreadsheet I have 01/05/08

when I read it into the msgBox it displays as 05/01/08

The following code snippit is to show you how I do it.

MsgBox sht.Cells(i, 6).Value

sht is a variant I SET to Sheets("HOLData").




Mark Ivey[_2_]

Dates Being displayed the wrong way around.
 
Here are some formatting features you might find useful....

Mark Ivey

Note: you can replace the "Range("A1")" with the cell reference you were
using if you prefer



MsgBox Range("A1").Value

MsgBox Format(Range("A1").Value, "MM/DD/YY")
MsgBox Format(Range("A1").Value, "DD/MM/YY")
MsgBox Format(Range("A1").Value, "DDD MM/DD/YYYY")
MsgBox Format(Range("A1").Value, "DDD MMM DD YYYY")
MsgBox Format(Range("A1").Value, "DDD MMMM DD YYYY")


NateBuckley

Dates Being displayed the wrong way around.
 
Cheers, for some reason a restart fixed the problem :S weird, but I
appreciate the list of different Formats you presented. I shall give them a
whirl.

Thanks again!

"Mark Ivey" wrote:

Here are some formatting features you might find useful....

Mark Ivey

Note: you can replace the "Range("A1")" with the cell reference you were
using if you prefer



MsgBox Range("A1").Value

MsgBox Format(Range("A1").Value, "MM/DD/YY")
MsgBox Format(Range("A1").Value, "DD/MM/YY")
MsgBox Format(Range("A1").Value, "DDD MM/DD/YYYY")
MsgBox Format(Range("A1").Value, "DDD MMM DD YYYY")
MsgBox Format(Range("A1").Value, "DDD MMMM DD YYYY")



All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com