ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Position a user form next to selected cell (https://www.excelbanter.com/excel-programming/417374-position-user-form-next-selected-cell.html)

nowhereman

Position a user form next to selected cell
 
I have a macro which calls a user form

When the user form opens as the macro runs it is in the center of the
screen..... is it possible to cause it to be positioned next to the
selected cell.

I see a "manual" choice in the form properties, I am not brilliant enough
to figure how to make that setting work manually, much less with code.

TIA for any help you have time to offer

NWM

joel

Position a user form next to selected cell
 
This code should work. You may want to add a little to the Left Position to
move it away from the cell


LeftPos = ActiveSheet.ActiveCell.Left
Wdth = ActiveSheet.ActiveCell.Width
TopPos = ActiveSheet.ActiveCell.Top

UserForm1.Left = LeftPos + Wdth
UserForm1.Top = TopPos

Userform1.show


"nowhereman" wrote:

I have a macro which calls a user form

When the user form opens as the macro runs it is in the center of the
screen..... is it possible to cause it to be positioned next to the
selected cell.

I see a "manual" choice in the form properties, I am not brilliant enough
to figure how to make that setting work manually, much less with code.

TIA for any help you have time to offer

NWM



All times are GMT +1. The time now is 10:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com