Locking CommandButton in UserForm in VBA

Shodi

Board Regular
Joined
May 24, 2016
Messages
51
Hi Everyone.
I am trying to write a VBA code where the UserForm resizes dynamically depending on values retrieved from cell counts.

I have worked that out but I need to have the CommandButton locked to the lower right-hand corner of the UserForm so that it can easily be clicked once the data input is over.

Since the UserForm resizes itself (it can become really big depending on the values captured) from a minimum of 1 textbox to possibly 15 columns and 50 rows of textboxes, I cannot have it anywhere in the top or bottom centre (please let me know if I am wrong and this is possible).

The most viable option I feel is to stick it in the lower right corner of the UserForm.

It is possible to have it in the upper left corner (it does remain stationary there) but that feels wrong...based on conventional structure.

Please let me know what can be done.

Thanks
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Taul

Well-known Member
Joined
Oct 24, 2004
Messages
746
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Hi,
An alternative idea is to fix the size of your Userform and put your textboxes into a Frame. Then add vertical scroll bars to the frame.

Link here for details of adding the scroll bars to a frame
 

Watch MrExcel Video

Forum statistics

Threads
1,118,765
Messages
5,574,105
Members
412,571
Latest member
Ventura7
Top