Excel, how do I write a macro to convert the date value to text?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My worksheet contains several thousand records in which I have 3 columns with
date values. I need to know how to write a macro that would add a tick mark
to the beginning of each date to convert it to a text format.
 
Sub ConvertDates()
Dim cell as Range
for each cell in selection
cell.value = "'" & cell.Text
cell.Numberformat = "General"
Next
End Sub

select the cells to convert and run the macro.
 
Back
Top