title: Excel - VBA First working day of the month
body: <p>I've an workbook_open macro as below; </p>
  
  <pre><code>Private Sub Workbook_Open()
  Sheets("Staff List").Activate
  
  If Range("G1") = "Yes" Then
  
  Sheets(Format(Now, "mmmm")).Activate
  
  Range("A1").Select
  Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
  
  End If
  
  End Sub
  </code></pre>
  
  <p>The formula in G1 is as below;</p>
  
  <p><code>=IF(OR(TODAY()=WORKDAY(EOMONTH(TODAY(),-1),1,0),TODAY()=WORKDAY(EOMONTH(TODAY(),-1),2,0)),"Yes","No")</code></p>
  
  <p>So checking to see whether today is either the first or second working day of a month. How would remove the need to reference G1 and instead work the formula directly into the VBA?</p>
  
  <p>Many thanks</p>