Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding 4 cells next to eachother and then adding the following fourcells [email protected] Excel Programming 3 May 29th 08 09:00 AM
adding some rows in the middle of adding some other rows Janis Excel Programming 3 October 4th 07 03:20 AM
Adding a new row [email protected] Excel Programming 5 February 1st 07 07:28 PM
Help with adding 10% Jennifer Excel Worksheet Functions 2 January 31st 07 08:56 PM
Adding Up! ExcelBob Excel Discussion (Misc queries) 0 June 14th 06 02:20 PM


All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"