Hi,
I would like to delete all rows below a row number based on the entry into an input box. I can't seem to figure out how to formulate the range using the "n" as variant. Below is the code which I partially used from another code in my workbook. Thanks for your help.
I would like to delete all rows below a row number based on the entry into an input box. I can't seem to figure out how to formulate the range using the "n" as variant. Below is the code which I partially used from another code in my workbook. Thanks for your help.
VBA Code:
Sub DeleteAllBelow()
Dim n As Variant 'Long 'Integer, rng As Range
With Application
.DisplayAlerts = False
.DisplayStatusBar = True
.EnableEvents = False
.ScreenUpdating = False
End With
ActiveSheet.Select
n = InputBox("ENTER ROW NUMBER")
If n = vbNullString Then Exit Sub
Rows("n:5000").Delete
With Application
.DisplayAlerts = True
.EnableEvents = True
.ScreenUpdating = True
.StatusBar = False
End With
End Sub