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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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
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,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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