Define which sheet (tab) opens

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Define which sheet (tab) opens

Post by Egg 'n' Bacon »

Probably quite simple, but I can't find out how to specify (with VBA) which sheet is the default one - according to a basic IF.

Here is what I tried (unsuccessfully), in the 'ThisWorkbook' object:

Code: Select all

Private Sub Workbook_Open()

  If Sheets ("Raw_Data").Range("B3").Value = Null Then
    Sheets("Raw_Data").Select
    Range("B3").Select
  Else
    Sheets("Menu").Select
    Range"B3").Select
  End If

End Sub
TIA

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Define which sheet (tab) opens

Post by Rudi »

Instead of "Null", use ""

Try:

Code: Select all

If Sheets("Raw_Data").Range("B3").Value = "" Then
You could also use .Value = Empty
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Define which sheet (tab) opens

Post by Egg 'n' Bacon »

Thank you, the "" works a treat.