Open userform when worksheet opens

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,199
Office Version
  1. 2007
Platform
  1. Windows
Morning,

My goal is when i open the workbook i should see INCOME (1) open & either show the userform or not depending on cell value in B1
What i see happening is if i was last on worksheet INCOME (3) then i save & close the workbook when i next open it the code runs BUT when i close the userform i need to the close it once again.

This doesnt happen if the last worksheet was INCOME (1)

I have the two codes in use shown below,
This in the ThisWorkBook,

Code:
Private Sub Workbook_Open()With Worksheets("INCOME (1)")
.Activate
.Range("A4").Select
End With
If Range("B1") = "" Then
Range("A4").Select
MYFINCOMEONE.Show
Else
End If
End Sub

I also have this code in the right click on the worksheet tab,

Code:
Private Sub Worksheet_Activate()
If Range("B1") = "" Then
Range("A4").Select
MYFINCOMEONE.Show
Else
End If
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
hi,
try

Code:
Private Sub Workbook_Open()


    With Worksheets("INCOME (1)")
        .Activate
        If Len(.Range("B1").Value) = 0 Then MYFINCOMEONE.Show
    End With


End Sub

Dave
 
Upvote 0
Hi,
I get the same issue.
I need to click on the close option twice
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,202
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top