PDA

View Full Version : [SOLVED] Have a Label/Command Button Run a Spin Button (cross posted)



NewYears1978
02-19-2015, 12:03 AM
I have a userform that has a Spin Button in it, and I am trying to hit a Command Button (or Label in this case) and make it run the SpinDown and then Another to run the SpinUp, but this doesn't appear to work.

Is this not possible?

My Spin Buttons look like this:


Public Sub SpinButton1_SpinDown()
'SCAN FORWARD
ShowCurrentRecord
With New MSForms.DataObject
.SetText TextBox1.Text
.PutInClipboard
End With
End Sub


Public Sub SpinButton1_SpinUp()
'SCAN BACKWARD
ShowCurrentRecord
With New MSForms.DataObject
.SetText TextBox1.Text
.PutInClipboard
End With
End Sub


I tried this:


Private Sub Label14_Click()
SpinButton1_SpinDown
End Sub


and



Private Sub Label14_Click()
UserForm1.SpinButton1_SpinDown
End Sub



Thanks in advance for any help. :yes


(Of you need the reasoning behind this, it is so I can use better visuals for my Spin buttons than the default ugly ones)

mancubus
02-19-2015, 12:26 AM
welcome to VBAX.

please post a link to your thread in other forums. when your post count is 5 you can paste links.

until then you can provide the link by insertind spaces before and after dots like:

http:// www . vbaexpress . com/ forum/showthread.php?51816-Have-a-Label-Command-Button-Run-a-Spin-Button-(cross-posted)

mancubus
02-19-2015, 12:28 AM
are they on the same userform?

if not:


Public Sub Label14_Click()
UserForm1.SpinButton1_SpinDown
End Sub

NewYears1978
02-19-2015, 12:39 AM
are they on the same userform?

if not:


Public Sub Label14_Click()
UserForm1.SpinButton1_SpinDown
End Sub


They are on the same userform and I tried the above (I think it's what I posted up above) but it errors.

Edit:
Yes that is what I tried and it seems to do nothing when I click them. (no error, just no result)

NewYears1978
02-19-2015, 01:39 AM
Was solved via other thread


Private Sub Label13_Click()
If SpinButton1.Value - 1 >= SpinButton1.Min Then
SpinButton1.Value = SpinButton1.Value - 1
SpinButton1_SpinDown
End If
End Sub

Private Sub Label14_Click()
If SpinButton1.Value + 1 <= SpinButton1.Max Then
SpinButton1.Value = SpinButton1.Value + 1
SpinButton1_SpinUp
End If
End Sub

mancubus
02-19-2015, 02:06 AM
They are on the same userform and I tried the above (I think it's what I posted up above) but it errors.

Edit:
Yes that is what I tried and it seems to do nothing when I click them. (no error, just no result)

they are not indeed: Private vs Public
Public worked for me when i tested.

please mark the thread as solved for future references...

NewYears1978
02-20-2015, 02:42 PM
they are not indeed: Private vs Public
Public worked for me when i tested.

please mark the thread as solved for future references...

Done and thank you :)