View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nashlow Nashlow is offline
external usenet poster
 
Posts: 2
Default Hide column depending on its header

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