Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Positioning a userform properly

Posted on 2011-09-02
4
Medium Priority
?
294 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

715 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