View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Michael Hopwood Michael Hopwood is offline
external usenet poster
 
Posts: 37
Default If then statement

Try:

'--------------------------------

Dim rng as range
set rng = activesheet.range("Z1:Z26")

dim c as range
for each c in rng.cells
if c.value = "area1" then
c.interior.colorindex = 32
else
c.interior.colorindex = 1 '??? or whatever
end if
next

'---------------------------------


That should give you a starting point.

--
Michael Hopwood (Phobos)


"Todd Huttenstine" wrote in message
...
Below is part of a code that works, but I need to make it
conditional. I would like to have the code perform this
function:

If the value "area1" is found anywhere in Range Z1:Z26,
perform the code.
Range("area1").Interior.ColorIndex = 32

How would I write this?

Thank you.
Todd Huttenstine