Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Need help hiding/unhiding column based on autofilter selection in a different column

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kcleere - 22 Jan 2006 20:47 GMT
I have a task before me I need help with.

I have a customer (My Boss) who wants to hide 2 columns in a
spreadsheet automatically when a specific text is selected from an
"autofilter list" in a different column.  Then, show the hidden column
again when any other text is selected in the filter list column.

It's not obvious to me how to do this or if it can be done in Excel.
I'd appreciate any input you have here.

Thank you in advance for any input you have.
sjoo.kwak@gmail.com - 23 Jan 2006 06:21 GMT
If you change your selection of a item from "autofilter list",
Worksheet_Calculate event is triggered,
therefore you can write macro you want using this event procedure.

for example,

Private Sub Worksheet_Calculate()
   Dim w As Worksheet, f As Long

   Set w = sheet2

   With w.AutoFilter
       With .Filters
           For f = 1 To .Count
               With .item(f)
                   If .On Then

'// When Jan.15,93 is selected, you want to hide some columns
                       If .Criteria1 Like "*01-15-93" Then

'// Codes Hiding some columns are here
                           Debug.Print "Hide Columns"
                           Exit Sub

                       End If
                   End If
               End With
           Next
       End With
   End With
End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.