Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Below is a handy code I have used to serch a range and delete all cells with
a 0. I need to modify this slightly so it will not only delete the cells with 0, but all the cells with 0 along with the four cells to the left of that cell. For example, if cell F5 has a 0 in it, it will delete cells A5:F5. Dim xRange As Range Dim xCell As Range For Each xCell In Sheets("SDII").Range("F2:F34") If xCell.Value = 0 Then If xRange Is Nothing Then Set xRange = xCell Else Set xRange = Union(xRange, xCell) End If End If Next xCell xRange.Delete Shift:=xlUp -- Thanks Shawn |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Target Address Property for Insert/Delete Row/Column | Excel Programming | |||
Writing a Macro to Find & Delete Target Rows in a Range | Excel Programming | |||
Delete Rows if any cell in Column H is blank but do not Delete Fir | Excel Programming | |||
Target cell reference moves when target is cut and pasted | Excel Discussion (Misc queries) | |||
Deleting Rows from using a target cell | Excel Programming |