spin button change event

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
Is a spin button change event triggered WHEVEVER a change occurs (be it by user or MACRO CODE)?

Gene, "The Mortgage Man", Klein
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi Gene

There may be a way, but I quickly tried this and it didn't work

Private Sub SpinButton1_Change()
If Range("$A$1").Value = "Yes" Then
Range("$A$1") = "No"
Exit Sub
End If
If Range("$A$1").Value = "No" Then Range("$A$1") = "Yes"
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 5 Then Exit Sub
SpinButton1.Value = SpinButton1.Value + 1
End Sub

The SpinButton value did not change when column five was changed

Maybe someone else has an idea.
 
Upvote 0
Acutually - I DIDN'T want it to trigger if changed by a macro. Yet look at the following: (I don't know why yours "failed"). Only changing the text box (and not the spin button) on the user form will show the MsgBox in SpinButton1_Change. My (very unclear and undetailed) OP was meant to find out how to STOP this behavior.

Gene, "The Mortgage Man", Klein

Private Sub SpinButton1_change()
MsgBox "Here we are in SpinButton1_Change"
End Sub

Private Sub TextBox1_Change()
SpinButton1.Value = SpinButton1.Value + 1
End Sub

Gene, "The Mortgage Man", Klein
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,947
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top