Error - Cannot Use that command on overlapping sections. SpecialCells(xlCellTypeBlanks)
I am using the code below to delete blank rows in a sheet. The sheet
will always have row1 containing headers, row 2 is blank and the data
starts at row3. I found that my code works fine when the number of
rows is greater than 3, but if its 3 (i.e. a header, plus a blank row
plus one row of data) then I get the error message
"Cannot Use that command on overlapping sections".
I can add a check for the row qty, but I would like to understand what
My range for checking for blanks is all cells in column "AY" up to the
range of the sheet, starting from cell "AY3".
Note that sheetout(x) is a sheet as part of an array that I already
Dim RngBlanks as range
Dim PECColumn as Range
Set PECColumn = sheetout(x).Range("AY3:AY" &
On Error Resume Next
Set RngBlanks = PECColumn.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0 'Turn off Current Error Trap i.e. Resume Next
If Not RngBlanks Is Nothing Then
RngBlanks.EntireRow.Delete '<----Error occurs here
Any help greatly appreciated!