-
ScrollBar value * call Macro
Is it possible to let a scroll bar determine how many times a macro must repeat it self?
[VBA]Private Sub TextBox1_Change()
On Error GoTo Msg
ScrollBar1 = TextBox1.Value
Exit Sub
Msg:
MsgBox "Choose a number between 1-100"
End Sub[/VBA]
The macro is simple...
[VBA]Sub Macro3()
Selection.Insert Shift:=xlToRight
End Sub[/VBA]
Thank you
-
I don't follow the logic of the code. Why would you want to do this anyway?
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Not sure of your purpose either, but you used a text box change event, but talk about the scroll bar
This is on theWorksheet code page of the attached WB and uses an ActiveX version of the scroll bar control on that WS
[vba]
Option Explicit
Private Sub ScrollBar1_Change()
Dim i As Long
ScrollBar1.Max = 100
ScrollBar1.Min = 1
For i = 1 To ScrollBar1.Value
Called (i)
Next i
End Sub
Sub Called(i As Long)
Debug.Print i
End Sub
[/vba]
Paul
-
Someone else on the forum asked regarding this I am trying to help.
Thank you for the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules