Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Repost: hiding columns

Hi, with special bow to Bob and Frank :)
I re-clarify my previous post:

Task at hand is to hide a dozen columns i a "Main" sheet. - it has many more
of them.
I listed headings of interesting columns, stored them in 1 column vertical
list and named it "Elements" (stored on separate sheet)
I need effcient metod of parsing header row of the sheet and change column
width to 0 of those that match "Elements"
I think I saw a 1-liner or so for the task. I used to do full 2 range
looping - but it's 21st century, so I figure I gotta move ahead... :)

TIA
Paul



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Repost: hiding columns

there is no clever means to match a name in one column to the header in
another sheet.


You can use match to eliminate one loop

Dim rng as Range, cell as Range
Dim res as Variant
With Worksheets("Main")
set rng = .Range(cells(1,1),Cells(1,256).End(xltoLeft))
End With
for each cell in Range("Elements")
res = application.Match(cell,rng,0)
if not iserror(res) then
rng(1,res).EntireColumn.Hidden=True
end if
Next

--
Regards,
Tom Ogilvy

"count" wrote in message
...
Hi, with special bow to Bob and Frank :)
I re-clarify my previous post:

Task at hand is to hide a dozen columns i a "Main" sheet. - it has many

more
of them.
I listed headings of interesting columns, stored them in 1 column vertical
list and named it "Elements" (stored on separate sheet)
I need effcient metod of parsing header row of the sheet and change column
width to 0 of those that match "Elements"
I think I saw a 1-liner or so for the task. I used to do full 2 range
looping - but it's 21st century, so I figure I gotta move ahead... :)

TIA
Paul





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Repost: hiding columns

It'll be more elegant now- thanks Tom, very much!

Użytkownik "Tom Ogilvy" napisał w wiadomo¶ci
...
there is no clever means to match a name in one column to the header in
another sheet.


You can use match to eliminate one loop

Dim rng as Range, cell as Range
Dim res as Variant
With Worksheets("Main")
set rng = .Range(cells(1,1),Cells(1,256).End(xltoLeft))
End With
for each cell in Range("Elements")
res = application.Match(cell,rng,0)
if not iserror(res) then
rng(1,res).EntireColumn.Hidden=True
end if
Next

--
Regards,
Tom Ogilvy

"count" wrote in message
...
Hi, with special bow to Bob and Frank :)
I re-clarify my previous post:

Task at hand is to hide a dozen columns i a "Main" sheet. - it has many

more
of them.
I listed headings of interesting columns, stored them in 1 column

vertical
list and named it "Elements" (stored on separate sheet)
I need effcient metod of parsing header row of the sheet and change

column
width to 0 of those that match "Elements"
I think I saw a 1-liner or so for the task. I used to do full 2 range
looping - but it's 21st century, so I figure I gotta move ahead... :)

TIA
Paul







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding Columns SnareHiHat Excel Discussion (Misc queries) 2 October 16th 09 02:10 PM
Hiding Columns belony Excel Discussion (Misc queries) 4 June 15th 05 12:27 AM
Hiding columns Adam Excel Discussion (Misc queries) 2 March 31st 05 05:07 PM
(repost) Listbox Rowsource Headings Multi columns hgdev Excel Programming 1 April 13th 04 07:08 PM
Not Hiding Columns SS[_3_] Excel Programming 1 February 11th 04 10:27 PM


All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"