PDA

View Full Version : Search and replace



leovilla64
09-27-2017, 09:54 AM
Friends
I'm looking for a VBA code to replace, for example, I have in column A 01082017 I want to replace it to get date format 08/01/2017

Grateful
Leandro

mdmackillop
09-27-2017, 11:54 AM
You may need to swap the Month/Day values to suit your regional settings

Sub Test()For Each cel In Columns(1).SpecialCells(2, 1)
cel.Value = DateSerial(Mid(cel, 5, 4), Mid(cel, 3, 2), Mid(cel, 1, 2))
Next
End Sub