VBA:How conncect Scrollbar and Textbox in Userform

johnston

New Member
Joined
Mar 14, 2018
Messages
49
I have a userform with a scrollbar and textbox. How do you code it so that the scrollbar connects to the textbox? For example, I want the textbox to
increase/decrease by a value
each time you click the up/down-arrow on the scrollbar. Anything helps!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Why not set your texbox to AutoSize and Textwrap to false
Textbox will grow as you enter more text.
Use Shift enter to start new line.
 
Upvote 0
Do you want to set the value of the Textbox equal to the value of the Scrollbar?

If so, maybe...

Code:
Private Sub ScrollBar1_Change()
    Me.TextBox1 = Me.ScrollBar1.Value
End Sub

M.
 
Upvote 0
Do you want to set the value of the Textbox equal to the value of the Scrollbar?

If so, maybe...

Code:
Private Sub ScrollBar1_Change()
    Me.TextBox1 = Me.ScrollBar1.Value
End Sub

M.

Curious.
How does a scrollbar have a value?
 
Upvote 0
Please explain again what you want to happen when you click the scrollbar.
Do you want the value in the textbox to increase like if textbox1 has the value 1 then when you click on scrollbar you want textbox value to now be two.

Or do you want the size of the textbox to increase?
 
Upvote 0
Maybe you should take a look at the form's scroll event :

Private Sub UserForm_Scroll(ByVal ActionX As MSForms.fmScrollAction, _
ByVal ActionY As MSForms.fmScrollAction, ByVal RequestDx As Single, _
ByVal RequestDy As Single, ByVal ActualDx As MSForms.ReturnSingle, ByVal ActualDy As MSForms.ReturnSingle)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,658
Messages
6,120,778
Members
448,992
Latest member
prabhuk279

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