+ Reply to Thread
Results 1 to 3 of 3

UserForm's Command button moves when using scrollbar

  1. #1
    Registered User
    Join Date
    01-09-2013
    Location
    Montreal, Quebec, Cnada
    MS-Off Ver
    Office 365 MSO 64 bits (16.0.12130.20272)
    Posts
    9

    UserForm's Command button moves when using scrollbar

    Hi,

    In excel vba, I have a userform with a typical OK command button to which I dynamically add (from left to right) several textboxes. When the number of textboxes are such that their total width is superior to the width of the form, I activate the form's horizontal scroll bar and set the ScrollWidth so the textboxs can all be visible and/or accessed by the user using the horizontal scroll bar at the bottom of the userform. My only problem is that the OK command button also moves when I use the scroll bar.

    Is there any technics I could use, vba or otherwise, to freeze the command button position to a specific position on the userform while the user use the horizontal scrollbar ?

    Thank You very much for your help
    Sylvain
    Last edited by zsylvainz; 02-14-2020 at 10:37 PM.
    ZsylvainZ

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: UserForm's Command button moves when using scrollbar

    Add a Frame control to your userform with the Textboxes added inside the frame and the Command Button outside. The Frame can have its own horizontal scroll bar that won't affect anything outside.

    Scroll Bars in a Frame
    Last edited by AlphaFrog; 02-14-2020 at 11:53 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    01-09-2013
    Location
    Montreal, Quebec, Cnada
    MS-Off Ver
    Office 365 MSO 64 bits (16.0.12130.20272)
    Posts
    9

    Re: UserForm's Command button moves when using scrollbar

    lol why didn't I think of that, it's a great idea ! Thank you a thousand times. Much appreciated

    Sylvain

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to make a Command button run the "FORM" command to fill/populate a table?
    By jrobin7 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-21-2012, 12:26 PM
  2. Why is the scrollbar in a user form, by the first click on a button, scrolling?
    By Excel-Master in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-21-2010, 11:01 PM
  3. Form - Command Button
    By shugg24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2010, 09:28 AM
  4. VB's Command Button vs Form's Command Button
    By Ronald Dodge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2006, 09:30 AM
  5. Command Button Moves when sheet printed
    By DarbyDog in forum Excel General
    Replies: 2
    Last Post: 09-22-2005, 10:24 AM
  6. [SOLVED] Make more info appear when mouse moves over a macro command button
    By Jeff at Bosch Corp. in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2005, 05:06 PM
  7. ActiveX Command Button Moves after Printing
    By Roger-Bullivant in forum Excel General
    Replies: 1
    Last Post: 04-01-2005, 04:10 PM
  8. Command Button Moves
    By Matto in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2005, 10:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1