Consulting

Results 1 to 6 of 6

Thread: Solved: Hide/show column base on checkbox caption

  1. #1

    Solved: Hide/show column base on checkbox caption

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub chkFriend_Click()
    With Worksheets("Friend")

    If Me.chkFriend Then

    .Visible = xlSheetVisible
    Else

    .Visible = xlSheetHidden
    End If
    End With
    End Sub
    [/vba]

    etc.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    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

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You said userform.

    Now you have lost me completely.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Quote Originally Posted by xld
    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
    Last edited by Designer6; 01-29-2008 at 09:40 AM.

  6. #6

    Problem solved

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •