VBA Code to Add Serial Number in Excel Sheet | Macro to Add serial numbers in Excel
Its is very easy to add numbers sequentially in Excel by using VBA code.
Step 1: Open excel sheet and Press Alt + F11 Button
Step 2: Go to the Insert Tab and select new Module
Step3: Copy the below code and then save it.
Step 4: Click on F2 to run the VBA Code.
Sub AddSerialNumbers()
Dim i As Integer
OnError GoTo Last
I=InputBox(“Enter”,”Enter Serial Numnbers”)
For i = 1 to i
ActiveCell.value = i
ActiveCell.Offset(1,0).Active
Next i
Last:Exit Sub
End Sub
Comments
Post a Comment