Many times we have to add a column of nos in our data. Now we can set a macro which can generate a sequence of numbers using till the value mentioned in row.
For this Copy and paste below Excel VBA code syntax in your excel file
'Code for Generating Numbers in sequence
Sub Generate_Numbers()
Dim i As Long, j As Long
j = ActiveCell.Value
If (j <= 1048576) Then
For i = 1 To j
ActiveCell.Value = CStr(i)
ActiveCell.Offset(1, 0).Activate
Next
Else
MsgBox ("Value should be less than 1048577")
End If
End Sub
'Code for Generating Numbers in sequence
Sub Generate_Numbers()
Dim i As Long, j As Long
j = ActiveCell.Value
If (j <= 1048576) Then
For i = 1 To j
ActiveCell.Value = CStr(i)
ActiveCell.Offset(1, 0).Activate
Next
Else
MsgBox ("Value should be less than 1048577")
End If
End Sub