+ Reply to Thread
Results 1 to 5 of 5

Using CheckBox.Caption to determine the workseet name

  1. #1
    Registered User
    Join Date
    12-10-2011
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Post Using CheckBox.Caption to determine the workseet name

    Hi,

    I have many checkboxes named under the file's worksheets. May I use CheckBox.Caption in order to go to a worksheet?

    My suggestion would be like that, but it's not working:

    Please Login or Register  to view this content.
    See an example in the file attached.

    Thanks for your help!
    Attached Files Attached Files
    Last edited by nicer2011; 12-20-2011 at 09:45 PM.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Using CheckBox.Caption to determine the workseet name

    What happened when you tried it?

    Oh, I see the problem. As written "ActiveSheet.OLEObjects(i).Object.Caption" is being passed as a literal string.
    If you want to go to the sheet whose name is the caption, use this
    Please Login or Register  to view this content.
    Last edited by mikerickson; 12-20-2011 at 10:01 PM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    12-10-2011
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Using CheckBox.Caption to determine the workseet name

    I still have an error:

    Run time error 9: Subscript out of range

    Thanks

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,617

    Re: Using CheckBox.Caption to determine the workseet name

    Check the sheet names against the checkbox captions:
    Please Login or Register  to view this content.
    Results:
    Please Login or Register  to view this content.
    Notice the spaces at the beginning of the actual sheet names, ergo, the caption <> sheet.name
    Last edited by protonLeah; 12-21-2011 at 12:38 AM.
    Ben Van Johnson

  5. #5
    Registered User
    Join Date
    12-10-2011
    Location
    Montreal, Canada
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Using CheckBox.Caption to determine the workseet name

    Hi,

    Thanks for your suggestion, protonLeah. I've changed the space at the beginning of the actual sheet names, but still not working - error 1004 this time

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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