![]() |
Adding a Zero
I'm looking for a macro that will add a zero of the first character in
column starting in the row 2 (W2 to Last row with data). Example: This: aaaaaaa bbbbbb cccccc Would look like: This a0aaaaaa b0bbbbb c0ccccc Little Penny |
Adding a Zero
Dim LastRow As Long Dim i As Long With ActiveSheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 2 To LastRow .Cells(i, "A").Value = Left(.Cells(i, "A").Value, 1) & "0" & _ Right(.Cells(i, "A").Value, Len(.Cells(i, "A").Value) - 1) Next i End With -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Little Penny" wrote in message ... I'm looking for a macro that will add a zero of the first character in column starting in the row 2 (W2 to Last row with data). Example: This: aaaaaaa bbbbbb cccccc Would look like: This a0aaaaaa b0bbbbb c0ccccc Little Penny |
Adding a Zero
Give this a try...
Sub AddZero() Dim X As Long Dim LastRow As Long With Worksheets("Sheet3") LastRow = .Cells(Rows.Count, "W").End(xlUp).Row For X = 2 To LastRow With .Cells(X, "W") .Value = Left(.Value, 1) & "0" & Mid(.Value, 2) End With Next End With End Sub Rick "Little Penny" wrote in message ... I'm looking for a macro that will add a zero of the first character in column starting in the row 2 (W2 to Last row with data). Example: This: aaaaaaa bbbbbb cccccc Would look like: This a0aaaaaa b0bbbbb c0ccccc Little Penny |
All times are GMT +1. The time now is 05:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com