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

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top