title: Excel VBA - Validation Data and comma delimited strings
body: <p>I am trying to create data validation cells purely with VBA. The problem is, if one of the 
  items in the validated list is a Excel formula which contains commas (such as the IF() in the following code) an error is generated.</p>
  
  <pre><code> Dim str As String
   str = "=IF(SUM(A1:A2) = 0, ""Zero"", SUM(A1:A2)) , Item 2 , Item 3 , Item 4"
  
   s1.Range("B6").Validation.Add Type:=xlValidateList, _
            AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=str
  </code></pre>
  
  <p>The error (runtime error 1004) is generated because it delimits the string at the first comma, so the first item of the validation is <code>"=IF(SUM(A1:A2) = 0"</code>. I'm hoping there are escape characters for the commas (such as \ in C) to avoid this.
  I want the validated list to appear as such:</p>
  
  <pre><code>&lt;result of IF() function&gt;
  Item 2
  Item 3
  Item 4
  </code></pre>
  
  <p>Note: I CANNOT use a range for the validated data. If the user deleted the range the spreadsheet would be broken.</p>