Scrollbars on Multiple Textboxes

grimley2

New Member
Joined
Feb 1, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
I'm using this to force scrollbars to appear on one textbox, however I have three textboxes on my form that need this treatment. Is it possible to do this with multiple textboxes on the same form?
VBA Code:
With textbox1
        .ScrollBars = fmScrollBarsBoth
        .EnterFieldBehavior = fmEnterFieldBehaviorRecallSelection
        .Value = q
        .SetFocus
        .SelText = q
        .SelStart = 0
        .SelLength = 0
        .SelText = ""
    End With
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
All you are doing with the code block above is setting properties for textbox1. If you want the same properties for other textboxes, you'll need to repeat the block for each textbox, substituting in their names in place of textbox1.
 
Upvote 0
..this is my issue. When I repeat this codeblock three times, one for each textbox, it only ends up effecting one of the three.
 
Upvote 0
Please post all three parts of the relevant code so I can better see exactly what you are doing.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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