Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hiding Columns | Excel Discussion (Misc queries) | |||
Hiding Columns | Excel Discussion (Misc queries) | |||
Hiding columns | Excel Discussion (Misc queries) | |||
(repost) Listbox Rowsource Headings Multi columns | Excel Programming | |||
Not Hiding Columns | Excel Programming |