I apologize for the delay in responding - got distracted
by one of those "I've got to have this report for my
boss for the VP tomorrow and I need *you* to get
all the data pulled together" kind of orders that took
me away.
To both of you - my thanks. Between these two ideas
it now only works but it is faster too.
David
"Dick Kusleika" wrote in message
...
David
David F. Schrader wrote:
Assume the following "for each" loop:
for each column_in_loop in Range("A1:Z1")
If ( column_in_loop.value = "something" ) then
With column_in_loop.EntireColumn
.interior.colorindex = 3
.interior.pattern = xlSolid
End With
end if
next ' column_in_loop
The variable column_in_loop will be a single cell as your loop iterates
through each cell in A1:Z1. When you get to the point where that cell
equals "something", you turn the single cell reference into the whole
column
by using the EntireColumn property. If B1 = "something" then
Range("B1").EntireColumn.Address will equal $B:$B.
If there is only one column that will meet that criteria, put an Exit For
statement inside your if block. That way, the loop won't check every cell
in the range, but will stop when it gets to the one that matters.
--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com