I search first my range of rows, then I want to delete all the rows
Sub DeleteAll()
Dim firstCAP As Range
Dim lastCAP As Range
'set START DATA_collect
Sheets("DATA_collect").Activate
Range("N6").Activate 'start search here at DATA_collect
firstCAP = ActiveCell.Rows
'goto first cell that is empty
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Activate
Loop
ActiveCell.Offset(-1, 0).Activate
lastCAP = ActiveCell.Rows
Rows("firstCAP:lastCAP").Select
Selection.Delete Shift:=xlUp
End Sub
I get a 'Run time error 91'
Object variable or with block variable not set.
Where can I change the code in order to get it work?
Bookmarks