Solved

Positioning a userform properly

Posted on 2011-09-02
4
281 Views
Last Modified: 2012-05-12
I understand that a userform's .left and .top properties are numbers that relate to the current screen.

I have a userform that I need to popup to the right of a button I have on my sheet. The button is positioned at Range("AY1").Left - 10.

Since Range().Left is a distance from column A to whatever range I'm specifying, I can't use that to position my userform. For me, Range("AY1").Left is 2548.5. My screen (Application.Width) is 972.

I'm not sure how I go about setting my startup position of my userform to where I want it to be (which is basically at ".Left of my button + .width of my button + 5" or something close to that).

I know I _could_ do Range("AY1").Left - Range("AL1").Left, but there's no guarantee that for someone else, the left-most column of the current window will be AL. I feel like I need to somehow find out where on my current window Range("AY1").Left is...

I hope I'm not completely overthinking this and am missing something obvious, though that's always possible. :)

Thanks in advance as always.
0
Comment
Question by:KenHadley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 12

Expert Comment

by:telyni19
ID: 36475506
So you want a userform to appear to the right of a button that could be off the screen if the sheet is scrolled to the left? Does this button trigger the form? In other words, does the button have to be in a visible place in order for the form to appear?

I think by definition, if you're using a pop-up form, it has to be on-screen, so it has to appear somewhere in the visible width of your file. The way you've described the file so far, that may or may not include your button.
0
 

Author Comment

by:KenHadley
ID: 36475636
> Does this button trigger the form? In other words, does the button have to be in a visible place in order for the form to appear?

Yes. The form won't be an issue if the button is off-screen.

I've attached a picture that shows exactly what I've been talking about. The calendar (userform) was popped up by clicking the calendar button. I've positioned it according to my screen & resolution manually, but ofc I want this automated to be able to adapt to various resolutions. But where it is now is basically where I'd like it to be on any computer this file is used with.

Hope this is a little more clear. Let me know if there's any other questions.

ee-buttonwithform.jpg
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 36483640
It's not obvious - see Chip's page here: http://www.cpearson.com/Excel/FormPosition.htm

If you are using a version of Excel pre 2007, you can also create a tiny blank chart, activate it and use the position of the chart window to locate the form, but from 2007 onward, that window doesn't exist. (you can use the formula editing window if you have in-cell editing switched on, but that's messy)
0
 

Author Comment

by:KenHadley
ID: 36503417
Thanks rorya. Guess it's not as easy as I was hoping it would be. I think Chip's page will get me to where I need to be, so thanks for the link!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question