Empty spinner button

cliffmid

New Member
Joined
Aug 5, 2016
Messages
8
I see lots on cells cleared in spinner button code, but not how to clear the cached spinner button itself. I have a spinner linked to A1. I run A1 up to five. My code to clear A1 works perfectly. But when I come back to the sheet (with A1 cleared) and use the spinner again, it--the spin button--remembers the five and my next entry is six. I want both A1 and the cached memory in the button itself cleared. It has me stumped.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You can't clear a spinner, it always has to have a value. You can reset it to the minimum value or some defined default starting point, but it always has a value.
 
Upvote 0
This will reset Spinner 1 to start from zero (first up click will go to 1 if increment is 1). If your spinner is not named Spinner 1 then change that part of the code.

ActiveSheet.Shapes("Spinner 1").ControlFormat.Value = 0
[a1].ClearContents
 
Upvote 0
Private Sub SpinButton1_Change()

'sets target cell. target and spin button must be unlocked in protected shee

Range("p20").Value = SpinButton1.Value
Sub ClearOrders()
'
' ClearOrders Macro
' Clears colored boxes for next week's meeting
'
' Keyboard Shortcut: Ctrl+t

Dim Result As Integer
Result = MsgBox("Clears Yellow and Green entries, still want to continue?", vbQuestion + vbYesNo)
If Result = vbYes Then


Sheets("Lunch").Select

'Application.Goto Reference:="orders"

Range("c2:e35,g2:i35,k2:m35, p20").Select
Selection.ClearContents

Else

MsgBox "Press OK to Exit"
End If



Range("b2").Select


End Sub
Here's is the spinner code. The ControlFormat.Value =0, [all].clearContents would not run. I may have it in the wrong sub. I have it in the SpinButton1 code above. The second sub clears the other fields. Thanks in advance
The actual sheet is:
1611591821372.png
 
Upvote 0
You are using an ActiveX spin button, the .ControlFormat code is for one from the Forms menu.
For an ActiveX spin button this code would set it to its minimum
VBA Code:
With ActiveSheet.OLEObjects("SpinButton1").Object
    .Value = .Min
End With
 
Upvote 0
Solution

Forum statistics

Threads
1,223,888
Messages
6,175,203
Members
452,617
Latest member
Narendra Babu D

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