Hey again, I was wondering if anyone could help with a spin button programming.
I am looking to change 2 fields on an excel sheet - C21 and C22- with a spiin button(up and down)
I did some research and found the code below which works but when i click anywhere on the screen i can change the value, i am looking to have 1 spin button change C21 when i am clicked on it and when I click on C22 i can change the number of it(up or down)
the code below works, but i can click anybox on the excel sheet and change the number which is not acceptable. Does anyone know how to do this.
any help is appreciated.
-------------------------------------
Private Sub SpinButton1_SpinUp()
With Selection(1)
If VarType(.Value) = vbDouble Or _
VarType(.Value) = vbEmpty Then
.Value = .Value + 1
AppActivate "Microsoft Excel"
End If
End With
End Sub
Private Sub SpinButton1_SpinDown()
With Selection(1)
If VarType(.Value) = vbDouble Or _
VarType(.Value) = vbEmpty Then
.Value = .Value - 1
AppActivate "Microsoft Excel"
End If
End With
End Sub
--------------------------------------------------------------
Bookmarks