Text to Columns Wizard

excelnoobnoob

New Member
Joined
Jun 27, 2017
Messages
29
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have a data connection to a csv in my excel workbook.
One of the columns contains dates in mm/dd/yy format.
Excel won't accept 'format as date', so I searched online and found a solution (use the Convert Text to Columns Wizard).
This works! The column is now formatted correctly as date.
The only issue is, whenever the data source refreshes, the column reverts to the original, general format.

Does anybody know what can be done to resolve such an issue?
 
Private Sub Worksheet_Change(ByVal Target As Range) Dim LR As Long, i As Long, x If Intersect(Target, Range("C:C")) Is Nothing Then Exit Sub Else Application.EnableEvents = False Range("C:C").NumberFormatLocal = "mm/dd/yy;@" LR = Cells(Rows.Count, 3).End(xlUp).Row x = Range(Range("C2"), Cells(LR, 3)) For i = 1 To UBound(x) x(i, 1) = CDate(Format(x(i, 1), "##/##/####")) Next Range(Range("C2"), Cells(LR, 3)) = x End If Application.EnableEvents = True End Sub
Thanks ver much Takae, this worked perfectly !!
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,214,830
Messages
6,121,835
Members
449,051
Latest member
excelquestion515

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