Link to home
Create AccountLog in
Avatar of tmaususer
tmaususerFlag for United States of America

asked on

Excel 2010 Open Workbook via VBA

I have a very simple form created in excel 2010. On the form in cell E43 I have a conditional drop down box with a yes or no choice. I have a macro with the following code.

If Worksheets("Sheet1").Range("e43").Value = "Yes" Then
Workbooks.Open Filename:="S:\Test\Information\Form.xls    
End If
End Sub

This works if I select yes in the drop down but in order to get my form.xls to open I have to tab off of cell e43. How can I get the form.xls to open immediately one time upon selecting yes?
SOLUTION
Avatar of Anthony Berenguel
Anthony Berenguel
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of tmaususer

ASKER

Ah. That simple. Ok one more add on. My worksheet opens fine but minimizes to my task bar. Any way to open that up maximized and have the user decide to minimize?
Avatar of Haris Dulic
Try this code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E43")) Is Nothing Or Target.Cells.Count > 1 Then Exit Sub
If Target = "Yes" Then
Workbooks.Open Filename:="S:\Test\Information\Form.xls"
End If
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account