View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Hee's another "for each" question

I look forward to virtually eating them :-)

Bob


"David F. Schrader" wrote in message
...
My thanks to you both. Both is these ideas
helped. The one got me what I wanted and
the second helped me wring out a little more
speed - always a nice consideration.

David

The virtual "Oreo" truck will be delivering
a load of virtual cookies to each of you
some time in the virtual future as a reward
for your assistance. David.


"David F. Schrader" wrote in message
...
Assume the following "for each" loop:

for each column_in_loop in Range("A1:Z1")
If ( column_in_loop.value = "something" ) then
columns.select
with selection
.interior.colorindex = 3
.interior.pattern = xlSolid
with end
end if
next ' column_in_loop

The idea is to color the column that contains the
"something" color "3" and pattern it "xlSolid" while
leaving all other columns un-touched.

In reality this loop colors and patterns everything in
the A:Z columns "3" and "xlSolid" - not just the
column whose first cell in the range ("A1:Z1")
contains whatever is specified by "something" in the
"IF."

It's great to remove the color or pattern from the
whole table is that were what I were trying to do.
Any ideas on how to "tighten" it down so I can do
just the one column which contains the what tested
for in the IF?

It's sure to be easy I just haven't found it yet.

David