ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for editing a series of cells (https://www.excelbanter.com/excel-programming/421450-macro-editing-series-cells.html)

LaDdIe

Macro for editing a series of cells
 
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.
--
Laddie

Gary''s Student

Macro for editing a series of cells
 
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''s Student - gsnu200820


"Laddie" wrote:

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


LaDdIe

Macro for editing a series of cells
 
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.
--
Laddie


"Laddie" wrote:

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



All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com