Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clear contents with condition
Hi everyone,
I'm a novice user in Excel Macros... still a lot more to be learn. I need to write a code to clear cell contents under from column H if the cell contains "(" I used: Range = €œH:H€ For each cell in range If substring of cell.value=")" then cells.ClearContents next In advance, thank you for your help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clear contents with condition
Hi, i'm using this (there are other options to do this):
Sub Clear() Row = 1 Do Until Cells(Row, 8) = "" Text = Cells(Row, 8) If Text = """(""" Then Cells(Row, 8).ClearContents Row = Row + 1 Loop End Sub This code is searching for your string until it reach first empty cell in column H. Henrich €žVanna" napÃ*sal (napÃ*sala): Hi everyone, I'm a novice user in Excel Macros... still a lot more to be learn. I need to write a code to clear cell contents under from column H if the cell contains "(" I used: Range = €œH:H€ For each cell in range If substring of cell.value=")" then cells.ClearContents next In advance, thank you for your help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Clear contents with condition
Hi Vanna - I never use something as a variable that is too similar to a reserved word and Cells is one of them.
Personally I'd use .... Sub RemoveH() Dim c As Range For Each c In [H1].Resize([H65536].End(xlUp).Row, 1).Cells If Not Application.IsError(Application.Find("(", _ c.Value)) Then c.Value = "" Next c End Sub Regards Robert McCurdy "Vanna" wrote in message ... Hi everyone, I'm a novice user in Excel Macros... still a lot more to be learn. I need to write a code to clear cell contents under from column H if the cell contains "(" I used: Range = €œH:H€ For each cell in range If substring of cell.value=")" then cells.ClearContents next In advance, thank you for your help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Clear Contents | Setting up and Configuration of Excel | |||
Clear contents of cells if a condition is met | Excel Worksheet Functions | |||
Clear Contents | Excel Discussion (Misc queries) | |||
Macro clear cells if meet 1 condition | Excel Worksheet Functions | |||
Clear contents if x is not in the row | Excel Programming |