Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Hide Unhide Picture And Cell Content Using CheckBoxes

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Jul 2013
    Posts
    102
    Rep Power
    12

    Hide Unhide Picture And Cell Content Using CheckBoxes

    This example will need code,There are 2 checkboxes.Can I checkbox hide/unhide the picture and the other checkbox hide/unhide the text,Can the picture be a fixed size and always insert exactly like in the attached example.
    Can each checkbox say hide/unhide depending on which state the button is in
    Jeff
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Jul 2013
    Posts
    102
    Rep Power
    12

    Checkbox To Hide Unhide Picture And Text

    Hi

    Can VBA code be used here so that when i check either box it hides or unhides.One checkbox will say Hide Picture when visible and Unhide Picture when not visible...The other checkbox will do the same for the Text

    Thanks

    Jeff
    Attached Files Attached Files

  3. #3
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    Not sure , but does this attachment help you ?
    Attached Files Attached Files
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  4. #4
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    And what about the other post you posted?

    http://www.excelfox.com/forum/f2/hid...eckboxes-1317/
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  5. #5
    Senior Member
    Join Date
    Jul 2013
    Posts
    102
    Rep Power
    12
    Thank you

    Could I request a change....could the code show both the Picture and Text at the same time when selected and hide both the Picture and Text at the same time when selecting to hide

    The code is great and appreciated

    Apologies for the posts but I keep changing my mind on what I wanted.ExcelFox example is excellent as well

    Jeff
    Attached Files Attached Files

  6. #6
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  7. #7
    Senior Member
    Join Date
    Jul 2013
    Posts
    102
    Rep Power
    12
    Thank you ExcelFox....works a treat

    Is there a code I can use to protect the cells involved so that the picture and Text cannot be deleted when visible

    or would you recommend a another way to protect

    Jeff

  8. #8
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Paste this in the respective sheet module

    Code:
    Private Sub CheckBox1_Click()
    
        If Me.CheckBox1.Value = True Then
            Me.CheckBox1.Caption = "Unhide"
            Me.Shapes("WARNING").Visible = msoFalse
        Else
            Me.CheckBox1.Caption = "Hide"
            Me.Shapes("WARNING").Visible = msoTrue
        End If
        
    End Sub
    
    Private Sub CheckBox2_Click()
    
        If Me.CheckBox2.Value = True Then
            Me.CheckBox2.Caption = "Unhide"
            Me.Range("B2").Value = ""
        Else
            Me.CheckBox2.Caption = "Hide"
            Me.Range("B2").Value = "WARNING DO NOT ENTER"
        End If
        
    End Sub
    But curious as to why you want to do this with two checkboxes, instead of one?
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  9. #9
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    To do this with just one checkbox, use this. This is also in response line with the posts at http://www.excelfox.com/forum/f2/che...and-text-1316/

    Code:
    Private Sub CheckBox1_Click()
    
        If Me.CheckBox1.Value = True Then
            Me.CheckBox1.Caption = "Unhide"
            Me.Shapes("WARNING").Visible = msoFalse
            Me.Range("B2").Value = ""
        Else
            Me.CheckBox1.Caption = "Hide"
            Me.Shapes("WARNING").Visible = msoTrue
            Me.Range("B2").Value = "WARNING DO NOT ENTER"
        End If
        
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  10. #10
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    I have just merged both the threads
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. VBA To Hide And Unhide Rows
    By paul_pearson in forum Excel Help
    Replies: 10
    Last Post: 05-08-2013, 03:14 AM
  2. Hide/Unhide Columns with Listbox
    By obed_cruz in forum Excel Help
    Replies: 2
    Last Post: 05-28-2011, 07:26 PM
  3. Hide and Unhide Rows and Columns
    By Admin in forum Download Center
    Replies: 0
    Last Post: 05-11-2011, 12:00 AM
  4. Replies: 2
    Last Post: 05-06-2011, 02:59 AM

Posting Permissions

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