Results 1 to 13 of 13

2 Numbers, 1 Spin Button

Threaded View

  1. #1
    Registered User
    Join Date
    05-20-2010
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003
    Posts
    21

    2 Numbers, 1 Spin Button

    Okay so the background is a bit of the following, I'm trying to edit 1 number by an incriment value of 1, while another number is also edited using a backwards calculation dependant upon the value of the first number being edited. The problem here is two-fold: first the number in the second column doesn't change unless I click 'run', and secondly, the number it keeps returning is wrong (I think it's just doing it the once).

    The code I'm using is the following:


    Sub Spinner13_Change()
    
    End Sub
    
    Private Sub SpinButton13_SpinDown()
        Dim incrimentVal As Integer
        
        With Range("D3")
            Select Case Range("D3").Value
                Case Is < 10
                    incrimentVal = -1
                Case Is < 12
                    incrimentVal = -2
                Case Is < 15
                    incrimentVal = -3
                Case Is < 17
                    incrimentVal = -4
                Case Is < 100
            End Select
            Range("M4") = Range("M4") + incrimentVal
        End With
    End Sub
    Private Sub SpinButton13_SpinUp()
        Dim incrimentVal As Integer
        
        With Range("D3")
            Select Case Range("D3").Value
                Case Is <= 10
                    incrimentVal = -1
                Case Is <= 12
                    incrimentVal = -2
                Case Is <= 15
                    incrimentVal = -3
                Case Is <= 17
                    incrimentVal = -4
                Case Is <= 100
            End Select
            Range("M4") = Range("M4") + incrimentVal
        End With
    End Sub
    The first number, and the number the spinner is currently tied to is "D3", the second number that is supposed to change based on that value is M4. I also want to eventually tie a restriction that M4 cannot be less than zero for changes to occur in D3, but that might take a bit longer.

    The second code I have is trying to edit the minimum value of the spinbutton when the user clicks a checkbox (hence declaring they are done with this portion of the edit). The code I'm using is:

    Sub CheckBox12_Click()
             Spinbutton13.Min = Range("D3")
    End Sub
    But it keeps returning 424 error. Any help with either of these things would be appreciated. Thanks. By the way.. if there is a list of functions that can be run in excel using VB that would be extremely helpful ^^
    Last edited by Evalis; 06-01-2010 at 02:23 AM.

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