Open userform when worksheet opens

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,322
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
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

dmt32

Well-known Member
Joined
Jul 3, 2012
Messages
5,816
Office Version
2019
Platform
Windows
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
 

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,322
Hi,
I get the same issue.
I need to click on the close option twice
 

Watch MrExcel Video

Forum statistics

Threads
1,099,122
Messages
5,466,818
Members
406,500
Latest member
Tknotmaxx

This Week's Hot Topics

Top