E
Elessvie
Hello, kind folks. Excel 2007 here. For the life of me I've been unable to
figure out why none of the 3 macros I have to delete blank rows is not
working. All of the macros are from this wonderful discussion group, and
they have ALWAYS worked with a little tweaking.
The spreadsheet I am trying to work on is a straight-ahead grid of 25,795
rows and columns A-N. Some cells are text, some are numbers, and I've set
them all to "Text." What happens when any of the macros run is that all of
the rows are deleted. I've tried various formats on the cells, but the
result is always the same.
Below are the macros I've been using. Could anybody please tell me what I
am doing wrong? Thank you for your time. -Lynne
MACRO ONE==========================================
Sub RemoveBlankRows()
Dim rg As Range, rgBlank As Range
'-------- CHANGE HERE -----------
Set rg = ActiveSheet.Range("A1:N25797")
'--------------------------------
'get blank cells from rg
On Error Resume Next
Set rgBlank = rg.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If rgBlank Is Nothing Then 'no blank cell
MsgBox "No Blank cells found"
Else 'else delete entire rows
rgBlank.EntireRow.Delete
End If
End Sub
MACRO TWO: ===========================================
Sub RemoveBlankRows2()
On Error Resume Next
Columns(1).SpecialCells(xlBlanks).EntireRow.Delete
On Error GoTo 0
End Sub
MACRO THREE: ==========================================
Sub RemoveBlankRows3()
On Error Resume Next
Range("A9:A25797").Cells.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
End Sub
figure out why none of the 3 macros I have to delete blank rows is not
working. All of the macros are from this wonderful discussion group, and
they have ALWAYS worked with a little tweaking.
The spreadsheet I am trying to work on is a straight-ahead grid of 25,795
rows and columns A-N. Some cells are text, some are numbers, and I've set
them all to "Text." What happens when any of the macros run is that all of
the rows are deleted. I've tried various formats on the cells, but the
result is always the same.
Below are the macros I've been using. Could anybody please tell me what I
am doing wrong? Thank you for your time. -Lynne
MACRO ONE==========================================
Sub RemoveBlankRows()
Dim rg As Range, rgBlank As Range
'-------- CHANGE HERE -----------
Set rg = ActiveSheet.Range("A1:N25797")
'--------------------------------
'get blank cells from rg
On Error Resume Next
Set rgBlank = rg.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If rgBlank Is Nothing Then 'no blank cell
MsgBox "No Blank cells found"
Else 'else delete entire rows
rgBlank.EntireRow.Delete
End If
End Sub
MACRO TWO: ===========================================
Sub RemoveBlankRows2()
On Error Resume Next
Columns(1).SpecialCells(xlBlanks).EntireRow.Delete
On Error GoTo 0
End Sub
MACRO THREE: ==========================================
Sub RemoveBlankRows3()
On Error Resume Next
Range("A9:A25797").Cells.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
End Sub