Clear Cell Contents

W

workerboy

Hi,

I was wondering if it was possible to clear the contents of a range of
cells in one row, if one of the cells in that range equals a certain
value.

For example if cell C2 = "THING", clear the contents of cells C2:G2.
I need this to go through a range such as from C2:C1000 and perform
that function each time C2,D2,E2,etc equals "THING"

Thanks to anyone who can help me out on this one!
 
G

Guest

for each cell in Range("C2:C1000")
if lcase(cell.Value) = "thing" then
cell.Resize(1,5).ClearContents
end if
Next

another faster way

set rng = Columns(3).find("THING")
if not rng is nothing then
do
rng.Resize(1,5).clearContents
set rng = Columns(3).FindNext(rng)
Loop while not rng is nothing
End if
 
W

workerboy

Thanks a lot for all your help, it worked like a charm!

I have to admit i probably didnt understand much of it. My VBA
knowledge is very basic at the moment...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top