blaisjoel

New Member
Joined
Oct 28, 2016
Messages
24
I have a cell containing today's date and formatted as 14 mars 2019. When assigning this value to a variable, it returns as 3/14/19. How do I get excel to assign the proper value?
Code:
DateToday = Cells(4, 4).Value
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

jmacleary

Well-known Member
Joined
Oct 5, 2015
Messages
1,026
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
Hi there. It depends on what you mean by 'proper value'. Excel treats dates as a sequential number, it displays that number in various ways depending on the format set. The actual value assigned to DateToday in your example is 43538 which is the number of days since jan 1st 1900. You just need to treat the variable correctly depending on what you are trying to do with it.

Hope this helps.
John
 
Last edited:

blaisjoel

New Member
Joined
Oct 28, 2016
Messages
24
I just want the program to copy the value in the cell and not the date behind it.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,655
Office Version
  1. 365
Platform
  1. Windows
How about
Code:
DateToday = Cells(4, 4).Text
 

Watch MrExcel Video

Forum statistics

Threads
1,109,542
Messages
5,529,438
Members
409,877
Latest member
DDhol
Top