Hello,
So i have the code below and I would like it to auto number the inserted rows below based on the value of the additonal tracks. the selected cell would be 1 and then the following 2-12.
Dim chk
Dim tracks As Long
' Exit if more than one cell selected
If Target.CountLarge > 1 Then Exit Sub
' Exit if selection not made to column C after row 3
If Target.Column <> 3 Or Target.Row < 3 Then Exit Sub
' Prompt user for how many tracks to insert
chk = MsgBox("Are there multiple tracks?", vbYesNo)
If chk = vbYes Then
On Error GoTo err_chk
tracks = InputBox("How many additional tracks are there (1-12)?")
On Error GoTo 0
If tracks >= 1 And tracks <= 12 Then
' Insert rows
Application.EnableEvents = False
Rows(Target.Row + 1 & ":" & Target.Row + tracks).Insert
Application.EnableEvents = True
Else
MsgBox "You have not entered in a valid number of tracks.", vbOKOnly, "ENTRY ERROR!"
End If
End If
Exit Sub
err_chk:
MsgBox "You have not entered a valid number.", vbOKOnly, "ENTRY ERROR!"
So i have the code below and I would like it to auto number the inserted rows below based on the value of the additonal tracks. the selected cell would be 1 and then the following 2-12.
Dim chk
Dim tracks As Long
' Exit if more than one cell selected
If Target.CountLarge > 1 Then Exit Sub
' Exit if selection not made to column C after row 3
If Target.Column <> 3 Or Target.Row < 3 Then Exit Sub
' Prompt user for how many tracks to insert
chk = MsgBox("Are there multiple tracks?", vbYesNo)
If chk = vbYes Then
On Error GoTo err_chk
tracks = InputBox("How many additional tracks are there (1-12)?")
On Error GoTo 0
If tracks >= 1 And tracks <= 12 Then
' Insert rows
Application.EnableEvents = False
Rows(Target.Row + 1 & ":" & Target.Row + tracks).Insert
Application.EnableEvents = True
Else
MsgBox "You have not entered in a valid number of tracks.", vbOKOnly, "ENTRY ERROR!"
End If
End If
Exit Sub
err_chk:
MsgBox "You have not entered a valid number.", vbOKOnly, "ENTRY ERROR!"