ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Spin button in a work sheet - how do I make it work? (https://www.excelbanter.com/excel-worksheet-functions/21017-spin-button-work-sheet-how-do-i-make-work.html)

[email protected]

Spin button in a work sheet - how do I make it work?
 
I can enter the spin button into a worksheet. However, I cannot get it to
change the target cell for changing values up or down. Do I need to write a
macro to do this for the spin button? If someone could walk me through one
of the ACTIVEX controls, I believe I could handle the remaining ones.

Thanks

Mike Moore

John Mansfield

Mike,

Assuming you are working with ACTIVEX controls and not the Forms controls .
.. .

To add a spinbutton to your worksheet:

View - Toolbars - Control Toolbor
Cick on the Controls Toolbox Design icon is activated, or in "Design Mode"
Drag the spin button from the Control Toolbar onto your worksheet
Click on the spin button once
Right-click on your mouse and select "Properties"
The most important fields are probably the spin button name, linked cell,
max, and min.
Set the linked cell, max, and min
When complete, deactivate the design mode on the Controls Toolbar

Assuming the sheet where the spinbutton resides is called "sheet1", you can
further control the spin button via VBA. This example shows spinup and
spindown procedures for a spin button named "Spinbutton1". The procedures
set the minimum and maximum values for the value in cell A1:

Private Sub SpinButton1_SpinDown()
With Range("A1")
.Value = WorksheetFunction.Max(-0.2, .Value - 0.001)
End With

End Sub
Private Sub SpinButton1_SpinUp()
With Range("A1")
.Value = WorksheetFunction.Min(0.2, .Value + 0.001)
End With
End Sub

Hope this helps.

----
Regards,
John Mansfield
http://www.pdbook.com

" wrote:

I can enter the spin button into a worksheet. However, I cannot get it to
change the target cell for changing values up or down. Do I need to write a
macro to do this for the spin button? If someone could walk me through one
of the ACTIVEX controls, I believe I could handle the remaining ones.

Thanks

Mike Moore



All times are GMT +1. The time now is 04:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com