View Full Version : Solved: Hide/show column base on checkbox caption
Designer6
01-29-2008, 08:38 AM
Hi all,
Is there a way i could show or hide a colum on a worksheet base on a selected checkbox caption ?
For example,
General worksheet has four labels "Friend, Customer, Return, Old"
four checkboxes on a userform with the same caption
Thanks,
V
Bob Phillips
01-29-2008, 08:51 AM
Private Sub chkFriend_Click()
With Worksheets("Friend")
If Me.chkFriend Then
.Visible = xlSheetVisible
Else
.Visible = xlSheetHidden
End If
End With
End Sub
etc.
Designer6
01-29-2008, 09:16 AM
Hello XLD,
Thanks for the reply
i am sorry what i meant is a worksheet labels "General" and in that worksheet i have four labels each at a different column. A userform with four labels as mentioned above and a "OK" button to proceed
Bob Phillips
01-29-2008, 09:24 AM
You said userform.
Now you have lost me completely.
Designer6
01-29-2008, 09:29 AM
You said userform.
Now you have lost me completely.
Sorry for my poor explainations. One more try :)
Userform has four checkboxes and a button with the following captions:
- Customer
- Return
- Friend
- Old
- "Ok" button
worksheet labels as "General" and it has the following names at different cell location
- customer
- Return
- Friend
- Old
Let's say i select checkboxes with caption "Friend" ,"Old" on the userform and hit "OK". On the "General" worksheet it should make the columns with those same names visible and hide the others.
I am able to code it base on whether the checkbox is true or fail but can't do it via checkbox caption
Designer6
01-30-2008, 03:55 PM
Thanks for all your help guys i got this part working. Below is a sample
If CheckBox2.Value = True Then
B = CheckBox2.Caption
If Not Sheets(Sheet).Cells.Find(B) Is Nothing Then MsgBox "I found you"
Range(B).EntireColumn.Hidden = False
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.