View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
count count is offline
external usenet poster
 
Posts: 64
Default Syntax needed for With

Ooops,
I haven't make myself clear enuf :)
NamedRange "Elements" is vertical 1 column list of interesting headings
Sheet to treat has oodles more columns - only some will get hidden - those
that ... you know.
thanks for your sooo quick response
Paul
Użytkownik "Bob Phillips" napisał w
wiadomości ...
Hi Paul,

There is no need for With this requirement.

There is nothing clever about With, it is just used to remove duplicated
object qualifying, thereby making the code more efficient as VBA does not
need to look up the reference each time, the With stores that reference in
memory, and makes the code easier to read IMO.

Here is the code you want

Dim col As Range

For Each col In ActiveSheet.Range("Elements").Columns
col.Hidden = True
Next col


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"count" wrote in message
...
Hi,
Task at hand is to hide those columns, whose headings are on the Named

Range
"Elements" list (stored aside)
I used to do it via plain looping but I saw recently clever usage of

With
construct.
I would like to learn how to put With into use and start using objects

more.
TIA
Paul