+ Reply to Thread
Results 1 to 6 of 6

Userform checkbox caption to hide work sheet

  1. #1
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Userform checkbox caption to hide work sheet

    Hi All,

    I'm finding it difficult to get the correct syntax for referencing a userform checkbox caption to hide a worksheet. The userform initializes with checkboxes, each one captioned from each sheet name in the workbook. The user checks the sheets they would like to use in the next step of the process and leaves sheets they would like hidden, unchecked. When the command button on the userform is pressed to continue, my code should populate a list on a new sheet called Email Data and hide those sheets that remain unchecked.

    The code so far works perfectly except for the part that should hide the unwanted sheets!

    My code is this with the problem code highlighted red:

    Please Login or Register  to view this content.
    You can see that I am tyring to use the checkbox caption variable as the sheet name so that the worksheet can be hidden in the active workbook but this line errors out no matter what combination I use. I've googled extensively but have not been able to find anything to assist me. Does anyone have an idea what I am doing wrong?

    Many thanks!
    Dave C

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform checkbox caption to hide work sheet

    What error(s) are you getting?

    How are you setting the captions of the checkboxes?

    PS Have you considered using a listbox to list the sheet names? If you used one it could be set up so each row has a checkbox.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Re: Userform checkbox caption to hide work sheet

    Hi Norie, thanks for the reply.

    I'm getting Object doesn't support this property or method. I guessed this was to do with the way I was referencing the checkbox caption.

    The checkbox captions are set up with this code:

    Please Login or Register  to view this content.
    1 To LastRow is a list of usernames. Each username has a corresponding sheet named the same.

    If there is no way to adjust my original code then I will investigate the listbox method but it's taken me three days to get this far! I am not familiar with listboxes yet but will get to know them if I have to!

  4. #4
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Re: Userform checkbox caption to hide work sheet

    Well, sometimes its right under your nose. I substituted Hidden for Visible and it worked!

    Please Login or Register  to view this content.
    Norie, thanks for the hint about listboxes. I will explore this one day!

    Thanks,

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform checkbox caption to hide work sheet

    I think the problem isn't really with the checkboxes, more likely to be because worksheets don't have a Hidden property.

    Try this.
    Please Login or Register  to view this content.
    PS If you add a listbox to the userform this is how you could populate it and set it up to have checkboxes for each row.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    10-08-2013
    Location
    London
    MS-Off Ver
    365
    Posts
    136

    Re: Userform checkbox caption to hide work sheet

    Hi Norie! Got it at the same time!

    Big thanks for the start up code for listboxes for me as well. This is really helpful and much appreciated!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hide rows based on userform checkbox
    By rodrignj in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-21-2015, 05:38 AM
  2. [SOLVED] Userform Checkbox caption
    By TimlmiT in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-03-2014, 10:28 AM
  3. [SOLVED] Change Checkbox Caption After Userform Activation
    By pjcbm9 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2014, 08:15 PM
  4. [SOLVED] Userform to rename caption of Multipage as per Checkbox
    By calvinle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2014, 11:07 AM
  5. Change Checkbox Caption on Userform with Name in Variable
    By XLVBA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-11-2013, 04:43 PM
  6. Get UserForm checkbox caption and pass to another UserForm on click or mouse down
    By tulsaguy71 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-08-2013, 11:07 AM
  7. Replies: 0
    Last Post: 11-15-2012, 12:29 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1