Hi I need to have one spin button to control multiple cells of my choice i.e. the one selected, rather than use 100+ spin buttons. Is this possible???
Hi I need to have one spin button to control multiple cells of my choice i.e. the one selected, rather than use 100+ spin buttons. Is this possible???
Don't think you can... but could you not make all the other cells equal the cell the spin button is linked to? For example make the spin button control A1, and then "=A1" in all the other cells?
Please help by:
Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know
There are 10 kinds of people in this world... those who understand binary, and those who don't.
Oh oops, you mean control only the active cell?
Yes I want the spin button to only control the active cell
Yes I want the spin button to only control the active cell
Last edited by ieuandavies; 05-01-2015 at 01:34 PM.
SOLVED!!! I type my own code for the sheet and now its working fine, thanks for the help anyway
Hi,
See the following code (using a Forms Spinbutton which is included in the attached file.
In an ordinary code module such as Module1:
Lewis![]()
Option Explicit Public vGblOldSpinButtonValue As Variant Sub FormsSpinButtonControlActiveCell() Dim vValue As Variant Dim iMaximumSpinButtonValue As Long Dim iMinimumSpinButtonValue As Long Dim iSpinButtonValue As Long Dim sControlName As String Dim sLinkedCell As String 'Get the name of the SpinButton Control that was activated 'Exit if this routine is not called by a SpinButton Click On Error Resume Next sControlName = Application.Caller If Err.Number <> 0 Then Err.Clear On Error GoTo 0 Exit Sub 'Exit if this routine is not called by a SpinButton Click End If On Error GoTo 0 'Get the current SpinButton attributes iSpinButtonValue = ActiveSheet.Shapes(sControlName).ControlFormat.Value iMinimumSpinButtonValue = ActiveSheet.Shapes(sControlName).ControlFormat.Min iMaximumSpinButtonValue = ActiveSheet.Shapes(sControlName).ControlFormat.Max sLinkedCell = ActiveSheet.Shapes(sControlName).ControlFormat.LinkedCell 'Initialize the SAVED 'SpinButton' Value on the First 'SpinButton' Click If Len(vGblOldSpinButtonValue) = 0 Then MsgBox "Initializing SpinButton SAVED Value." & vbCrLf & _ "The last SpinButton 'Click' was NOT PROCESSED." vGblOldSpinButtonValue = iSpinButtonValue Exit Sub End If 'Debug.Print 'Debug.Print ActiveSheet.Shapes(sControlName).Name 'Debug.Print ActiveSheet.Shapes(sControlName).ControlFormat.Value 'Debug.Print ActiveSheet.Shapes(sControlName).ControlFormat.Min 'Debug.Print ActiveSheet.Shapes(sControlName).ControlFormat.Max 'Get the value of the Active Cell 'If it is a NUMBER, increment or decrement as required vValue = ActiveCell.Value If IsNumeric(vValue) Then If iSpinButtonValue > vGblOldSpinButtonValue Then vValue = vValue + 1 Else vValue = vValue - 1 End If ActiveCell.Value = vValue End If 'Reset The SpinButton Value to the Middle of the Range if it is at MINIMUM or MAXIMUM If iSpinButtonValue = iMinimumSpinButtonValue Or iSpinButtonValue = iMaximumSpinButtonValue Then iSpinButtonValue = (iMinimumSpinButtonValue + iMaximumSpinButtonValue) / 2 ActiveSheet.Range(sLinkedCell).Value = iSpinButtonValue - 1 End If 'Save the Current 'SpinButton' value for comparison purposes on the next Pass vGblOldSpinButtonValue = iSpinButtonValue End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks