+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    06-10-2009
    Location
    here
    MS-Off Ver
    Excel 2003
    Posts
    36

    Toggle Button text changes

    I am trying to setup a Toggle button to change its "caption" when enabled disabled. I have the true false linked to Cell T2 and have the cells I need to change all setup to work with cell T2 cycling between true/false.

    What I would like to happen is when the button is clicked the caption changes and if possible the background colour change.

    My initial thought was to use the linked cell (T2) in the buttons VBA code to satisfy a If statement. But I dont know how to put this into practice.

    (BTW I enjoy learning how to code works more than just having someone post a bit of code.)

    Thanks.

  2. #2
    Valued Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2007
    Posts
    949

    Re: Toggle Button text changes

    I've done this before, once you figure out the true/false part of it it's easy.

    throw in something along the lines of:
    Code:
    if togglebutton1.value = false then
        togglebutton1.caption = "This button is turned off"
    endif
    
    if togglebutton1.value = true then
        togglebutton1.caption = "mew mew mew mew mew"
    endif
    I think it's "value" anyways, I'll revise this if my swiss cheese memory is playing games with me again :P

    edit
    Yay, I remembered something
    So yeah, now that you know about that part, you should be able to see how to have the button modify itself through the names in the properties screen for that button, you can change anything about it (or anything else for that matter) in that fashion.

    I use this for search engines and record keeping workbooks. I try to cut down on cluttered screens by having a button which for example... has the screen set to record a new entry, and says "Currently set to record entries, click to look up old entries", then clicking it changes itself, and some of the rest of the sheet to a lookup format instead of an entry one.

    hope that helps.

    mew!
    Last edited by mewingkitty; 07-02-2009 at 03:09 AM.
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  3. #3
    Registered User
    Join Date
    06-10-2009
    Location
    here
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Toggle Button text changes

    Thanks for the reply. I was able to change the colors and the rest of the properties.

    Any way of getting rid of the shading when the button has been changed from true to false?

  4. #4
    Valued Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2007
    Posts
    949

    Re: Toggle Button text changes

    If you mean "shadow"
    then yes
    it's another property of the button.
    togglebutton1.shadow = false
    ?

    mew!
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  5. #5
    Registered User
    Join Date
    06-10-2009
    Location
    here
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Toggle Button text changes

    Shadow is set as false. Still get the shading when the button is clicked.

  6. #6
    Valued Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2007
    Posts
    949

    Re: Toggle Button text changes

    can you post it? I'm not sure what we're trying to fix.
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

Thread Information

Users Browsing this Thread

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

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.2.0