Macro for editing a series of cells

  • Thread starter Thread starter Laddie
  • Start date Start date
L

Laddie

I am trying have a macro edit a series of cells automatically. Each cell is
the same format but has different information.

Basically I am trying to take a cell with a format of 0100 AM and have this
changed to 01:00 AM.

There is a large range of these cells thus the reason for wanting to
automate the insert of the colon.
 
If the values are genuine times, you can just change the format. If not,
select the cells and run this small macro:

Sub colonize()
For Each r In Selection
v = r.Text
r.Clear
r.NumberFormat = "@"
r.Value = Left(v, 2) & ":" & Right(v, 5)
Next
End Sub
 
Gary -

Thank you very much, it works like a charm...perfectly. I am far from a
programmer but have always been able to fight my way through Excel issues in
the past but this was one which was driving me crazy.

Can't thank you enough.... I owe you a beer.
 
Back
Top