Userform to open at current cell position

Chewyhairball

Active Member
Joined
Nov 30, 2017
Messages
312
Office Version
  1. 365
Platform
  1. Windows
Hi

How can I get a user form to open in line with the current cell position.
e.g if my current cell was F6 and i opened the userform it would look like this, and also to always open on the main screen if someone has multiple screens.

thanks

Rory
1633008687637.png
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Well on my computer this works.
Not sure it will work on all computers because it may have to do with screen resolution
And Excel sheet must be at 100% Zoom level
And I do not know how to this part:
to always open on the main screen if someone has multiple screens.

VBA Code:
Private Sub UserForm_Activate()
'Modified  9/30/2021  2:00:50 PM  EDT
Me.Top = ActiveCell.Top + 165
Me.Left = ActiveCell.Left + 30
End Sub
 
Upvote 0
Well on my computer this works.
Not sure it will work on all computers because it may have to do with screen resolution
And Excel sheet must be at 100% Zoom level
And I do not know how to this part:
to always open on the main screen if someone has multiple screens.

VBA Code:
Private Sub UserForm_Activate()
'Modified  9/30/2021  2:00:50 PM  EDT
Me.Top = ActiveCell.Top + 165
Me.Left = ActiveCell.Left + 30
End Sub
Thanks

I adjusted it to fit one cell but then if i select another cell it doesn't fit to it.
 
Upvote 0
Yes with those numbers it might not always work for every one. I used like Range("A1") +165
And I used Active cell
the height is consistent between cells in the same row but it moves further left with each column i move to the left
 
Upvote 0
i will do. If i can limit it somehow to columns CtoT they are all the same size.

watch this space :)
You do know if you open your userform like this:
UserForm1.show Modeless you can then click on the UserForm and move it around.
 
Upvote 0
Hi,
have a look here: Form Positioner
& see if this will do what you want

Author has provided link to download example of workbook.

Dave
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,495
Members
449,088
Latest member
Melvetica

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