View Full Version : Solved: Auto Numbering Alternative Column using VBA Macros
r_know
06-21-2012, 10:19 AM
Dear All,
I have several columns and I want they serially number number as per condition.
Condition If adjustant Cell having text then gives numbering and which follow up to 30 rows. Then, continuous serially follow for "C" column and "E" column
& next as long as.
Regards.
RahuL>
CatDaddy
06-21-2012, 10:40 AM
Sub numbering()
Dim arr() As Variant
Dim i As Variant
Dim cell As Range
Dim lr As Long, c As Long
ActiveWorkbook.Sheets("Construction 2").Activate
arr = Array(1, 3, 5, 7, 9, 11, 13)
For Each i In arr
lr = Cells(30, i + 1).End(xlUp).Row
c = 1
For Each cell In Range(Cells(1, i), Cells(lr, i))
cell.Value = c
c = c + 1
Next cell
Next i
End Sub
r_know
06-21-2012, 10:48 AM
Thanks CatDaddY,
It work good, but actually I need that "A" column serial number continue in C columns. Means all number serially continue further, not start again from 1.
Regards,
Rahul
CatDaddy
06-21-2012, 10:57 AM
Sub numbering()
Dim arr() As Variant
Dim i As Variant
Dim cell As Range
Dim lr As Long, c As Long
ActiveWorkbook.Sheets("Construction 2").Activate
arr = Array(1, 3, 5, 7, 9, 11, 13)
c = 1
For Each i In arr
lr = Cells(30, i + 1).End(xlUp).Row
For Each cell In Range(Cells(1, i), Cells(lr, i))
cell.Value = c
c = c + 1
Next cell
Next i
End Sub
CatDaddy
06-21-2012, 10:58 AM
sorry i misread your requirements the first time
r_know
06-21-2012, 11:04 AM
Excellent and gR8 Work!
Many Thanks !!~!!
CatDaddy
06-21-2012, 11:05 AM
no problem my man
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.