Link to home
Start Free TrialLog in
Avatar of tonelm54
tonelm54

asked on

Delete Rows

I need to delete rows from multiple sheets before I refresh the data, so I wrote the following:-
Sub refreshData()
    clearRange Sheets("All Incidents")
    clearRange Sheets("All Incidents 1")
    clearRange Sheets("All Incidents 2")
    clearRange Sheets("All Incidents 3")
    clearRange Sheets("All Incidents 4")
End Sub

Sub clearRange(targetSheet As Sheets)
    targetSheet.Rows("2:1000").Delete Shift:=xlUp
End Sub

Open in new window


But Im getting an error sayint targetSheet is not known. Any ideas how I can solve this issue?
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial