title: VBA error in data validation - Run time error '1004': Application defined or object defined error
body: <p>The purpose of this code is meant to format a range of cells and then program a data validation list into one of the cells. However, when I try this code, it continues to throw the error listed above upon reaching the line of code where I have Validation.Add .Can someone help me with this issue and maybe explain why this error is being triggered.</p>
  <pre><code>Sub Test()
      Dim defaultRow As Range
      Dim currentCellNum As Integer
      Set defaultRow = ActiveSheet.Range(&quot;R1:X1&quot;)
      currentCellNum = 1
      With ThisWorkbook.Worksheets(&quot;Sheet1&quot;)
          .Activate
          .Range(&quot;A&quot; &amp; currentCellNum).Select
          .Range(&quot;A&quot; &amp; currentCellNum) = defaultRow
  
          .Range(&quot;A&quot; &amp; currentCellNum).Interior.ColorIndex = 36
          .Range(&quot;B&quot; &amp; currentCellNum).Interior.ColorIndex = 0
          .Range(&quot;C&quot; &amp; currentCellNum).Interior.ColorIndex = 36
          .Range(&quot;D&quot; &amp; currentCellNum).Interior.ColorIndex = 0
          .Range(&quot;E&quot; &amp; currentCellNum).Interior.ColorIndex = 36
          .Range(&quot;F&quot; &amp; currentCellNum).Interior.ColorIndex = 36
          .Range(&quot;G&quot; &amp; currentCellNum).Interior.ColorIndex = 36
          
          .Range(&quot;A&quot; &amp; currentCellNum).Select
          .Range(&quot;A&quot; &amp; currentCellNum).Validation.Delete
          .Range(&quot;A&quot; &amp; currentCellNum).Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertsStop, Formula1:=&quot;A,B,C,D&quot;
  
      End With
  End Sub
  </code></pre>