Date Problem

LSM1604

New Member
Joined
Jan 8, 2010
Messages
49
Hello,

I have a form which puts a date into a cell, however I have a slight problem with it...

If the date within the form says 15/08/2010, then 15/08/2010 is displayed in the cell.

However, if the date within the form says 06/08/2010, then 08/06/2010 is displayed in the cell.

Why does the cell display the correct date if it is after the 12th in the month, and the wrong date (back to front) if it is the before the 13th of the month?? This doesn't make sense to me?

Any help would be much appreciated.

LSM1604


Below is a small section of my code:

Code:
    Range("Q5").Select
    With ActiveCell
   .NumberFormat = "dd/mm/yyyy"
   .Value = TextBox_DateHidden.Value
    End With
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Do it like this:

.Value = DateValue(TextBox_DateHidden.Value)

VBA is US-centric when it comes to dates, unless the day and month aren't ambiguous. The DateValue function is locale aware.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,865
Members
449,052
Latest member
Fuddy_Duddy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top