I have a macro that will identify whether there is any value in a specific cell in each tab. If it is blank, go to next tab but if there is data, delete all data and go to the next.
The issue I am facing is that the code below will delete only the data set but leaves blank rows (checked by going to a tab and pressing Ctrl and End).
I tried to use a range such as
but this deleted my headers too.
Thank you in advance,
The issue I am facing is that the code below will delete only the data set but leaves blank rows (checked by going to a tab and pressing Ctrl and End).
I tried to use a range such as
VBA Code:
Range("A2:AQ1048576")
VBA Code:
Dim ws, ws1c, ws2c, ws3c As Worksheet
Dim lRow As Long
Dim rng As Range
Set ws = Worksheets("Macro Centre")
Set ws2c = Worksheets("1c client services")
ws2c.Activate
lRow = Cells.Find(What:="*", _
After:=Range("A1"), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
Set rng = Range("A2:AQ" & lRow)
If Not IsEmpty(ws2c.Cells(2, 1).Value) Then
rng.EntireRow.Delete
End If
Thank you in advance,