+ Reply to Thread
Results 1 to 6 of 6

Button enable and disable...

  1. #1
    Forum Contributor
    Join Date
    12-11-2012
    Location
    Guadalajara, Mexico
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    101

    Button enable and disable...

    I have two buttons that I click to populate cells. Button 1 is clicked at the start of a call and button 2 when my call ends.

    Private Sub CommandButton1_Click()
    X = Sheets("calls").Cells(2, 3)
    Sheets("calls").Cells(X, 1) = Now()
    Sheets("calls").Cells(2, 3) = Sheets("calls").Cells(2, 3) + 1
    End Sub

    Private Sub CommandButton2_Click()
    X = Sheets("calls").Cells(2, 3) - 1
    Sheets("calls").Cells(X, 2) = Now()
    End Sub

    My issue is that button 1 can be clicked as many times as you want and what I want to do is only allow button 1 to be clicked, once button 2 has been clicked. What can I add to make this work like a toggle switch? Like press button 1 and disable it until button 2 is pressed...

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Button enable and disable...

    Why not use an actual Toggle Button?
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Button enable and disable...

    Better yet, try a spin button

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Button enable and disable...

    This is not tested but
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Button enable and disable...

    Maybe something like this:

    Please Login or Register  to view this content.
    abousetta

    P.S. Don't forget to use code tags...

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  6. #6
    Forum Contributor
    Join Date
    12-11-2012
    Location
    Guadalajara, Mexico
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    101

    Talking Re: Button enable and disable...

    Thank you very much... Both are great options. I learned to use something else other than just the command buttons and stood with the toggle it was a better fit for what I needed but the spin option was also GREAT. THANK YOU GUYS issue SOLVED

+ 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