Closed Thread
Results 1 to 2 of 2

assigning code to buttons

  1. #1
    Registered User
    Join Date
    08-26-2010
    Location
    canada
    MS-Off Ver
    Excel 2003
    Posts
    11

    assigning code to buttons

    I have two buttons on my sheet.
    I just created text boxes.... one has the text yellow4 and then other one green3.
    I want this assigned to yellow4.

    Sub Count()
    Dim x As Integer
    x = Range("A1").Value
    Range("A1").Value = x + 1
    x = Range("B1").Value
    Range("B1").Value = x + 1
    x = Range("C1").Value
    Range("C1").Value = 0
    End Sub

    and this assigned to green3

    Sub Count()
    Dim x As Integer
    x = Range("A1").Value
    Range("A1").Value = 0
    x = Range("B1").Value
    Range("B1").Value = x + 1
    x = Range("C1").Value
    Range("C1").Value = x +1
    End Sub

    how do I put those together so that the right code goes to the right text box.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: assigning code to buttons

    Good morning crazyhick

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

Closed 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