title: Excel macros, adding new sheets each day
body: <p>So I am attempting to create a sort of daily food diary in Excel and I know what I want it to do, I am just struggling implementing said ideas...<br>
  I have created a template that I want the user to enter into each day, but I don't want the user to have to create a new worksheet each day to achieve this, I want to create a macro that will run once Excel has been opened and will check the date that the last entry sheet was filled in, and if it is less that the current date, create a new worksheet and display that one to be filled in!</p>
  
  <p>Here is what I have found and tried so far but it isn't doing anything and coming up with errors.</p>
  
  <pre><code>Private Sub Workbook_Open()
  Dim sh As Worksheet
  Dim shName As String
  
  'name of the sheet template
  shName = "Food Diary.xltm"
  
  'Insert sheet template
  With ThisWorkbook
      If .Range("A1") &lt; Date Then
          .Range("A1") = Date
          Set sh = Sheets.Add(Type:=Application.TemplatesPath &amp; shName, _
                              after:=.Sheets(.Sheets.Count))
          'Give the sheet a name, today's date in this example
          On Error Resume Next
          sh.Name = "Day" &amp; " " &amp; Worksheets.Count
          If Err.Number &gt; 0 Then
              MsgBox "Change the name of Sheet : " &amp; sh.Name &amp; " manually"
              Err.Clear
          End If
          On Error GoTo 0
      End If
      End With
  
  End Sub
  </code></pre>
  
  <p>Hopefully you can see what I am trying to achieve with this.<br>
  If today's date is greater than the latest date in the sheet, create a new one named Day [number of sheets], I'm not sure about the date thing, as if date is entered into "A1" and a day passes would that not update when the workbook is opened?</p>
  
  <p>I also found something that seemed to be about hiding a sheet once the new one was created, This is something that would be quite good, it would be nice to have only the current day's sheet showing, but the others should still be accessible via like buttons that would scroll through each one after each press, I think I will be able to do the button coding but I am not sure about the visibility of the sheets and whether I would be able to unhide them once hidden, any help with this also would be great.</p>