Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditionally clearing a cell
How would I clear the contents of a cell, if the cell to the left of it didn't contain a value greater than zero, then proceede the the cell below that one and repeat the same action and so forth until there were no more values to check. I'm stumped. Thanks for any help...
Don Rountree |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Conditionally clearing a cell
One way:
Public Sub ClearIfCellToLeftIsNotPositive() Dim rCell As Range Dim rClear As Range For Each rCell In Range("B1:B" & _ Range("B" & Rows.Count).End(xlUp).Row) With rCell If .Offset(0, -1).Value <= 0 Then If rClear Is Nothing Then Set rClear = .Cells Else Set rClear = Union(rClear, .Cells) End If End If End With Next rCell If Not rClear Is Nothing Then _ rClear.ClearContents End Sub In article , Don Rountree wrote: How would I clear the contents of a cell, if the cell to the left of it didn't contain a value greater than zero, then proceede the the cell below that one and repeat the same action and so forth until there were no more values to check. I'm stumped. Thanks for any help... Don Rountree |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Clearing a cell based on the value of another cell (INDIRECT data) without macros | About this forum | |||
Clearing cells without clearing formulas | Excel Discussion (Misc queries) | |||
Clearing a cell | Excel Discussion (Misc queries) | |||
clearing a cell | New Users to Excel | |||
clearing a cell | Excel Discussion (Misc queries) |