title: VBA Adding Data Validation Programmatically
body: <p>I've looked online for an hour and can't find any solution that has worked for me. 
  I have a range of cells which I want to apply data validation to each cell in that range based on another range. I am not sure if I need a For Each loop or if I can just assign the validation to the whole list at one time. Here is what I have so far: </p>
  
  <pre><code>With Range(rngMonthStart, rngMonthEnd)
      With .Validation
           .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Formula1:= ("='Settings'!" &amp; totalrange.Address)
      End With
  End With
  </code></pre>
  
  <p>When it gets to the .Add line I get an Application Defined Error. Any help is super appreciated</p>