+ Reply to Thread
Results 1 to 3 of 3

make a shape a toggle

Hybrid View

Guest make a shape a toggle 01-13-2005, 10:06 PM
Guest Re: make a shape a toggle 01-13-2005, 11:06 PM
Guest Re: make a shape a toggle 01-14-2005, 12:06 AM
  1. #1
    Spencer Hutton
    Guest

    make a shape a toggle

    i have a shape on a worksheet named "Oval 1"
    i want to use the shape as a toggle button to change its color. a macro
    runs when it is clicked:
    If Range("A1") = False Then
    ActiveSheet.Shapes("Oval 1").Fill.ForeColor.SchemeColor = 65
    Range("A1") = True
    Exit Sub
    End If

    If Range("A1") = True Then
    ActiveSheet.Shapes("Oval 1").Fill.ForeColor.SchemeColor = 47
    Range("A1") = False
    Exit Sub
    End If

    the problem i am running into is that if you click the shape too fast, it
    stays the same color, but eventually changes if you wait a second. is there
    a better way to set it up like this so this problem doesn't happen?



  2. #2
    Norman Jones
    Guest

    Re: make a shape a toggle

    Hi Spencer,

    Assuming that it is not mandatory to use the value of cell A1, I simplified
    your macro somewhat:

    Sub sTester04()
    With ActiveSheet.Shapes("Oval 1").Fill.ForeColor
    .SchemeColor = IIf(.SchemeColor = 65, 47, 65)
    End With
    End Sub

    Testing this, I could not reproduce your experienced behaviour.

    When you "click the shape too fast", are you sure that you are not double
    (or treble!) clicking the oval. If this were the case, the oval would go
    through 2. 3 ...color changes with concomitant flicker and a noticeable
    delay while the screen repaints.

    ---
    Regards,
    Norman



    "Spencer Hutton" <shutton1@carolina.rr.com> wrote in message
    news:3dFFd.17108$fE4.2826522@twister.southeast.rr.com...
    >i have a shape on a worksheet named "Oval 1"
    > i want to use the shape as a toggle button to change its color. a macro
    > runs when it is clicked:
    > If Range("A1") = False Then
    > ActiveSheet.Shapes("Oval 1").Fill.ForeColor.SchemeColor = 65
    > Range("A1") = True
    > Exit Sub
    > End If
    >
    > If Range("A1") = True Then
    > ActiveSheet.Shapes("Oval 1").Fill.ForeColor.SchemeColor = 47
    > Range("A1") = False
    > Exit Sub
    > End If
    >
    > the problem i am running into is that if you click the shape too fast, it
    > stays the same color, but eventually changes if you wait a second. is
    > there a better way to set it up like this so this problem doesn't happen?
    >
    >




  3. #3
    Norman Jones
    Guest

    Re: make a shape a toggle

    Hi Spencer,

    After making my post i had an idea - hence my follow up. I then got called
    away, In the event the idea came to naught.

    So my post stands, except to say that in testing I used different color
    indexes (3 and 5) because there only color indexes 1 to 56.

    ---
    Regards,
    Norman



+ Reply to Thread

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.6.0 RC 1