Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with a "delete rows" Macro
Hey guys, can anyone help me with a macro I just cannot get worked
out. I have a simple "delete Blank rows" Macro, however the "Blank" cell is just the result of an "IF" function that returns a "" or blank cell. However the cell still holds the equation so it is not deleting the rows, even though they are blank (just not technically). I would like to know how I can get the macro below (or any other ideas you may have) to delete all the rows that return a False calculation due to an IF function, that uses columns A-G as the search method. I have copied my current macro below. Sub Macro3() ' ' Macro3 Macro ' Macro recorded 4/20/2007 by fletchej ' Columns("A:C").Select Selection.SpecialCells(xlCellTypeBlanks).EntireRow .Delete ActiveSheet.UsedRange ' End Sub Any explanation in a simplified form would be much appreciated, sometimes I get lost in all the code. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with a "delete rows" Macro
One way:
Public Sub DeleteRowsWithBlanksInColumnsAthroughG() Dim rDelete As Range Dim rCell As Range With ActiveSheet For Each rCell In Intersect(.Columns(1), .UsedRange) With rCell.Resize(1, 7) If Application.CountIf(.Cells, vbNullString) 0 Then If rDelete Is Nothing Then Set rDelete = .Cells Else Set rDelete = Union(rDelete, .Cells) End If End If End With Next rCell If Not rDelete Is Nothing Then rDelete.EntireRow.Delete End With End Sub In article .com, NewUser22 wrote: Hey guys, can anyone help me with a macro I just cannot get worked out. I have a simple "delete Blank rows" Macro, however the "Blank" cell is just the result of an "IF" function that returns a "" or blank cell. However the cell still holds the equation so it is not deleting the rows, even though they are blank (just not technically). I would like to know how I can get the macro below (or any other ideas you may have) to delete all the rows that return a False calculation due to an IF function, that uses columns A-G as the search method. I have copied my current macro below. Sub Macro3() ' ' Macro3 Macro ' Macro recorded 4/20/2007 by fletchej ' Columns("A:C").Select Selection.SpecialCells(xlCellTypeBlanks).EntireRow .Delete ActiveSheet.UsedRange ' End Sub Any explanation in a simplified form would be much appreciated, sometimes I get lost in all the code. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Last Cell" to find last row, but can't delete blank rows | Excel Discussion (Misc queries) | |||
Delete Rows that Contain the Text "Total" and vice versa | Excel Programming | |||
Search for the word "continued", if found, delete that row + 10 rows above | Excel Programming | |||
Search for the word "continued", if found, delete that row + 10 rows above | Excel Programming | |||
Search "Total" in all worksheets and delete rows containing "Total" | Excel Programming |