title: VBA Create a validation based on the first character of the entry into a cell
body: <p>Hi I am trying to create a cell validation in Excel through VBA. I am trying to do this through use of a wild card so that the validation in that cell will be based of the first character in the data entry. </p>
  
  <p>Here is the Code I am working with.</p>
  
  <pre><code>Dim wild1 as string
  wild1 = Cells(11, 7) Like "b*"
  
  With Cells(11, 7).Validation
      .Delete
      .Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Formula1:=wild1
  End With
  </code></pre>
  
  <p>With the code above I get a validation error every time I try to type something into Cell(11, 7). How would I change this so that the data entry would be valid if the first character in the data entry in that cell starts with a b?</p>
  
  <p>Thanks!</p>