View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Syntax needed for With

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