VBA DateValue help

ebilbrough

Board Regular
Joined
Nov 17, 2010
Messages
61
Office Version
  1. 365
Platform
  1. Windows
Fairly new with VBA. In cell range D2:AC2 I have dates in a text format (ex. 1/2/2017).

Looking for a way in VBA to convert the range to date format (mm/dd/yy).

Thanks.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Thanks JeanKim. It converted the cells to the custom date format (mm/dd/yy) but it didn't change how the dates are displayed.
 
Upvote 0
Thanks JeanKim. It converted the cells to the custom date format (mm/dd/yy) but it didn't change how the dates are displayed.

what was it before and what is it after the code changed format? also your example 1/2/2017 <---which number is month and which is date?
 
Upvote 0
Hi JeanKim - 1 is the month - January 2, 2017. The date display doesn't change. It remains 1/2/2017. Only the cell formatting changed - from General to Custom.
 
Upvote 0
Also, just noticed if I go to edit the cell (F2 - but make no edits) the display of the date changes to the desired format.

Is there any way to have this occur automatically within the VBA code?
 
Upvote 0
it should change display to format "mm/dd/yyyy"
I tested on my computer and it worked.
I don't know what the problem is on your computer.
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,462
Members
448,965
Latest member
grijken

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