title: Run A Macro By Clicking A Specific Cell In Excel with a condition/if statement
body: <p>I have successfully got this code working where you click on any cell in the range <code>F6:F16</code> and a date picker pops up and enters the date selected in the active cell. However, I would like to add a condition to running the macro that makes the date picker pop up, so that it only runs if the cell to the left contains the word <em>"Date:"</em> and if the cell to the left is blank, nothing should happen.</p>
  
  <p>e.g. When I click on cell <code>F8</code>, I want the macro to run (i.e. date picker to pop up) if cell <code>E8</code> contains <em>"Date:"</em>, but if cell <code>E8</code> is blank, the macro must not run (i.e. date picker must not pop up). </p>
  
  <p>Hope that makes sense.
  Here is my existing code without the condition:</p>
  
  <p><strong>Sheet 1 (Code)</strong></p>
  
  <pre><code>Option Explicit
  
  Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      If Selection.Count = 1 Then
          If Not Intersect(Target, Range("F6:F18")) Is Nothing Then
              Call datePick
          End If
      End If
  End Sub
  </code></pre>
  
  <p>Thanks</p>