Solved

Excel 2010 VBA form position

Posted on 2012-04-13
1
622 Views
Last Modified: 2012-04-17
Hi Experts

I have an excel spreadsheet with a user form, I cant position the form where I would prefer as I have a dual monitor and the application.left and application.top are positions based upon the 1st monitor posistion.

Ideally I want the form positioned on top of where the spreadhsheet is positioned.

Many thanks
0
Comment
Question by:MrDavidThorn
1 Comment
 
LVL 16

Accepted Solution

by:
theo kouwenhoven earned 500 total points
ID: 37842166
In the form properties, you can choose:

StartUpPosition = x

Where x can be 0 to 3

0 = Manual (you define where is should start with the Form.top and Form.Left function)
1 = Center owner (Center owner is the middle of your excelsheet)
2 = Center Screen (Center of the screen where the Excel sheet is opened)
3 = Window default (Coordinates 0,0)

If you like to open it relative to the excelsheet, use the following code:

UserForm1.StartUpPosition = 0
UserForm1.Left = Application.Left + 80
UserForm1.Top = Application.Top + 50
UserForm1.Show
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now