Position UserForm Relative to Cell

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
21,801
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I downloaded the sample workbook FormPositioner from Pearson's website.

First I replaced each occurence of VBA6 with VBA7 in the code.

Then I set the horizontal and vertical positions as follows...

VBA Code:
HO = cstFhpFormLeftCellRight    '   set these to how you want the form positioned relative to AnchorCell
VO = cstFvpFormTopCellTop       '   set these to how you want the form positioned relative to AnchorCell

However, while the horizontal position is aligned correctly, the userform is positioned well below the target cell. The top of the userform should be aligned with the top of the target cell.

Am I missing something?

Anyone have any other code that would position the userform relative to a cell?

Thanks!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Upvote 0
Solution
Hi Akuini,

I tried the solution offered by Yin Cognyto in that link you provided, and it seems to work just fine. It works properly even when the worksheet is zoomed in or out, and when the worksheet is resized.

Thanks very much for your help, I really appreciate it.

Cheers!
 
Upvote 0
I tried the solution offered by Yin Cognyto in that link

You're welcome. I also use Yin Cognyto's code in an add-in I created, namely Search deList, which has been downloaded more than 2K times, and it works pretty well.
 
Upvote 0
Oh wow, that's great to know. Already my testing showed that it worked well. But it's definitely re-assuring that it has worked well for you. (y) :cool:

Thanks again, I really appreciate!

Cheers!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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