# Always open workbook on sheet called "HOME"



## APML (Oct 27, 2022)

Hi all, I'm not very good at VBA and had lots of help building the code below...just want to modify so the workbook always opens on the sheet called Journal, 
I've got the following code already in the VBA section "This WorkBook" and have added the final part of the code which I hoped would get it to open on the worksheet called "Journal" (see the very last part of the code below) 
but I'm getting a Compile error: Ambiguous name detected: Workbook_Open

Was hoping someone would be able to help me fix

Private Sub Workbook_Open()
Call Initialise
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
blnClosing = True
dteEarliestTime = Now + TimeSerial(0, 0, 1)
Application.OnTime dteEarliestTime, "IsThisClosed"
End Sub

Private Sub Workbook_Activate()
Call Initialise(True)
End Sub

Private Sub Workbook_Deactivate()
If blnClosing Then
Application.OnTime dteEarliestTime, "IsThisClosed", , False
Else
    Call DeInitialise
End If
End Sub

Private Sub Worksheet_Deactivate()
Call DeInitialise
End Sub

Private Sub Worksheet_Activate()
Call Initialise
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

    On Error Resume Next
    If Sh.Name = "Analyse" Then
        MsgBox "ALWAYS REFRESH DATA Before Using This Sheet", vbInformation, "INBUILT, A Smarter Way To Trade"

    End If


    On Error Resume Next
    If Sh.Name = "Calendar" Then
        MsgBox "ALWAYS REFRESH DATA Before Using This Sheet", vbInformation, "INBUILT, A Smarter Way To Trade"

    End If
End Sub

Private Sub Workbook_Open()
Sheets("Journal").Select
Range ("A1")
End Sub


----------



## steve the fish (Oct 27, 2022)

You cant have two workbook open macros so just add your code to the one you already have.


----------



## APML (Oct 27, 2022)

steve the fish said:


> You cant have two workbook open macros so just add your code to the one you already have.


hey, thx for the help but I don't know enough about VBA to understand what you're saying.. can you be more specific?


----------



## steve the fish (Oct 27, 2022)

In what you provided there are two workbook open macros. You can only have one.


----------



## Candyman8019 (Oct 27, 2022)

Try this:


```
Private Sub Workbook_Open()
Call Initialise
worksheets("Journal").activate 
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
blnClosing = True
dteEarliestTime = Now + TimeSerial(0, 0, 1)
Application.OnTime dteEarliestTime, "IsThisClosed"
End Sub

Private Sub Workbook_Activate()
Call Initialise(True)
End Sub

Private Sub Workbook_Deactivate()
If blnClosing Then
Application.OnTime dteEarliestTime, "IsThisClosed", , False
Else
Call DeInitialise
End If
End Sub

Private Sub Worksheet_Deactivate()
Call DeInitialise
End Sub

Private Sub Worksheet_Activate()
Call Initialise
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

On Error Resume Next
If Sh.Name = "Analyse" Then
MsgBox "ALWAYS REFRESH DATA Before Using This Sheet", vbInformation, "INBUILT, A Smarter Way To Trade"

End If


On Error Resume Next
If Sh.Name = "Calendar" Then
MsgBox "ALWAYS REFRESH DATA Before Using This Sheet", vbInformation, "INBUILT, A Smarter Way To Trade"

End If
End Sub
```


----------



## FGaxha (Wednesday at 12:30 PM)

Use this code: copy in Workbook: Anytime when you open the workbook will be the Tab Name "Journal".

Private Sub Workbook_Open()

Sheets("Journal").Select

Sheets("Journal").Select

End Sub


----------

