Hope one of you with more knowledge of VBA can help.
The function of my macro is simple: delete e number of rows from a sheet. This only when macro is activated from the right position. Can you please give advise for the statements of the do-loop:
-------------
Sub Clearsheet()
'
Dim c As Range
'cell selected as variable
Set c = Selection
'cell ALxx contains the row number
'do not execute when activated from wrong position.....
If c.Row <> Cells(c.Row, "AL").Value Then Exit Sub
'now rows number 31 to c.Row -1 must be deleted from sheet
Do I = 31 to c.Row -1
Range(I:I).Select
EndDo
'All rows to be deleted are selected
Selection.Delete Shift:=xlUpEnd
End Sub
-------------
Thanks for your help
Paul
The function of my macro is simple: delete e number of rows from a sheet. This only when macro is activated from the right position. Can you please give advise for the statements of the do-loop:
-------------
Sub Clearsheet()
'
Dim c As Range
'cell selected as variable
Set c = Selection
'cell ALxx contains the row number
'do not execute when activated from wrong position.....
If c.Row <> Cells(c.Row, "AL").Value Then Exit Sub
'now rows number 31 to c.Row -1 must be deleted from sheet
Do I = 31 to c.Row -1
Range(I:I).Select
EndDo
'All rows to be deleted are selected
Selection.Delete Shift:=xlUpEnd
End Sub
-------------
Thanks for your help
Paul