mwisnefsky
New Member
- Joined
- Sep 3, 2013
- Messages
- 14
Hello,
I just started using Userforms to help force data entry to be correct. I was having difficulty getting the form to appear in the middle of the excel window though, so I looked online and found the following code snipped to add to the initialize sub:
So I added that code, clicked the button that runs the
command, the form popped up in the middle of the excel window and everything was great. However, I go and close that window, and I get "Run-time error '91': Object variable or With block variable not set" and its highlighting the
command as the problem line.
Before I added the code to control the starting position it worked fine. Any ideas why it would error out there? Any particular code in this you need to see?
I just started using Userforms to help force data entry to be correct. I was having difficulty getting the form to appear in the middle of the excel window though, so I looked online and found the following code snipped to add to the initialize sub:
Code:
With barcode .StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.Show
End With
So I added that code, clicked the button that runs the
Code:
Userform.Show
Code:
Userform.Show
Before I added the code to control the starting position it worked fine. Any ideas why it would error out there? Any particular code in this you need to see?