Results 1 to 6 of 6

Linking command buttons to option buttons

Threaded View

  1. #3
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Linking command buttons to option buttons

    OK, sorry for delay in replying and ignore the PM I sent cos it doesn't cover everything. In order to run this in an older version of excel I had to add .value to the end of all your range statements. However, the main issue is that your macro's have no way to reference which batsman / bowler is in play.

    To fix this, I've added macro's to all the selection dots next to the batsman / bowler names which write the row value to cells C37 and M37 (displayed in white text so you can't see it).

    Then I've replaced your 1 run macro with:

    Private Sub CommandButton1_Click()
                
                Dim Batsman, Bowler As Integer
                Batsman = Range("C37").Value
                Bowler = Range("M37").Value
                
                Range("j" & Batsman).Value = Range("j" & Batsman).Value + 1
                Range("k" & Batsman).Value = Range("k" & Batsman).Value + 1
                Range("o" & Bowler).Value = Range("o" & Bowler).Value + 1
                Range("p" & Bowler).Value = Range("p" & Bowler).Value + 0.1
                
    End Sub
    As you can see, you don't need the "mycount" variable, you can just reference the cells you want to change without using a variable. The cell that gets updated depends on what value is found in the cells C37 and M37. I'll leave the rest of the editing to you as you've got a lot of buttons on that thar spreadsheet.

    Tot siens.
    Attached Files Attached Files

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