PDA

View Full Version : [SOLVED:] VBA to Auto Number



paulcherianc
07-25-2017, 06:01 AM
Dear Experts!

I am trying to find a macro to :

1. Macro should clear all the previous numbering on the column A4 to A End.

2. Auto number a column starting from "A4" looking at the end of records in Column "B".

Can any one help in to fix this.

mana
07-25-2017, 06:38 AM
Option Explicit


Sub test()
Dim n As Long

With Range("A4")
Range(.Cells, .Cells.End(xlDown)).ClearContents
.Value = 1
n = Range("B" & Rows.Count).End(xlUp).Row - .Row + 1
If n > 1 Then .AutoFill .Resize(n), xlFillSeries
End With

End Sub

paulcherianc
07-25-2017, 06:45 AM
Cool! Succeeded! Thanks.