Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi there,
I am new to VBA and seeking help. I am basically needing to hide all range columns with exception of columns whose headers are that of East Coast cities. How do I accomplish this? Thanks -- Nashlow |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Nashlow,
Try: '============= Public Sub Tester003() Dim Col As Range Dim arrCities As Variant arrCities = Array("City1", "City2", "City3", "City4", "City5") For Each Col In ActiveSheet.UsedRange.Columns If IsError(Application.Match _ (Col.Cells(1).Value, arrCities, 0)) Then Col.Hidden = True End If Next Col End Sub '<<============= Replace City1 ...City5 with the required city names. --- Regards, Norman "Nashlow" wrote in message ... Hi there, I am new to VBA and seeking help. I am basically needing to hide all range columns with exception of columns whose headers are that of East Coast cities. How do I accomplish this? Thanks -- Nashlow |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Norman,
Code works perfect. It took me so far a week and you have saved me probably more! Great stuff. -- Nashlow "Norman Jones" wrote: Hi Nashlow, Try: '============= Public Sub Tester003() Dim Col As Range Dim arrCities As Variant arrCities = Array("City1", "City2", "City3", "City4", "City5") For Each Col In ActiveSheet.UsedRange.Columns If IsError(Application.Match _ (Col.Cells(1).Value, arrCities, 0)) Then Col.Hidden = True End If Next Col End Sub '<<============= Replace City1 ...City5 with the required city names. --- Regards, Norman "Nashlow" wrote in message ... Hi there, I am new to VBA and seeking help. I am basically needing to hide all range columns with exception of columns whose headers are that of East Coast cities. How do I accomplish this? Thanks -- Nashlow |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Counting Cells in a column depending on another column but excluding duplicates | Excel Discussion (Misc queries) | |||
Hide and protect worksheets depending upon who is looking? | Excel Discussion (Misc queries) | |||
Hide column header or first field in a list | Excel Discussion (Misc queries) | |||
hide button depending on date | Excel Worksheet Functions | |||
macro to hide column based on header | Excel Programming |