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 / September 2006

Tip: Looking for answers? Try searching our database.

Hiding columns based upon a value (or vice versa)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matthew Balch - 29 Sep 2006 15:44 GMT
How do I do VB to read a row then act on the relevant columns.

Say in row 6 I have 3 different variants, A B & C. If user pushes button A I
only want all the columns with A in row 3 displayed.

How do I do this?
Charles Chickering - 29 Sep 2006 18:39 GMT
Private Sub ButtonA_Click()
Dim cnt as long
Dim lCol as Long    'Last Column
Rows(3).EntireColumn.Hidden = False
lCol = Cells(3,Columns.Count).End(xlToLeft).Column
For cnt = 1 to lCol
   If Cells(3, cnt) <> "A" Then Columns(cnt).Hidden = True
Next
End Sub
Signature

Charles Chickering

"A good example is twice the value of good advice."

> How do I do VB to read a row then act on the relevant columns.
>
> Say in row 6 I have 3 different variants, A B & C. If user pushes button A I
> only want all the columns with A in row 3 displayed.
>
> How do I do this?
 
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.