moving controls in X & Y axis

  • Thread starter Thread starter Charlie
  • Start date Start date
C

Charlie

Is there a hotkey that you can use when moving a control on a userform that
will only allow X or Y axis movement, so if you've already aligned it up with
another control, you don't have to realign it again if you need to move it
closer?
 
For controls selected from the Control Toolbox, enter design mode, click the
control and use the arrow keys on the arrow keypad. For controls selected
from the Forms toolbar, right click the control and use the arrow keys on the
arrow keypad.
They move l, r, u and d.
 
In the compiled version of VB, the IDE allows you to move controls using the
arrow keys coupled with the Ctrl key; however, it seem the IDE designers in
VBA did not implement that very useful key combination. The only way I could
find to do what you want is somewhat cumbersome to do and it assumes you
have your "Align Controls to Grid" option enabled. Let's say you want to
move you control horizontally... click on Tools/Options on the menu bar,
click the General tab and change the Grid Units Height to 60 (make sure
there is a check mark in the "Align Controls to Grid" CheckBox) and then
press OK. You will now be able to move your control left and right without
worrying about vertical movement. To move your control vertically instead of
horizontally, do the same as above except set the Grid Units Height to 60
instead.

Rick
 
Just a footnote. You cannot make the adjustments while the code is running,
in case that was your question. The adjustments can only be made when there
is no procedure in process.
 
hmmm, too bad, it is quite cumbersome, quicker just to move it freehand, and
realign with the other control...
thanks.
 
I tried that and I can't get it to work on my system. I'm using XL2003 if
that matters.

Rick
 
Yes, I did say it was cumbersome. <g>

JLGWhiz posted a procedure that I can't get to work on my system; however,
you should give it a try in case it will work for you... if it works, it
would be very simple to use.

Rick
 
You're right, Rick. I missed the "on UserForm" part of the OP post. The
arrow keys only work on a sheet. The alignment facility appears to be the
quickest way on a UserForm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top