title: Excel VBA loop through multiple dependent drop down lists
body: <p>I have 4 dependent drop down lists with data validation, and I'm trying to loop through the entire list and make a copy of the workbook each time.
  I made a code using code from here: <a href="https://www.youtube.com/watch?v=OY5mqdcBdDk" rel="nofollow noreferrer">https://www.youtube.com/watch?v=OY5mqdcBdDk</a>
  However, my third level drop down list isn't looping and I end up getting results with the wrong matches in the hierarchy. How can I fix this?
  My drop down lists are in cell C6, F6, C7, and F7.
  Any help would be appreciated!</p>
  <pre><code>Sub myFiles()
  
  Dim wb As Workbook
  Dim ws As Worksheet
  Dim DVCell1 As Range
  Dim DVCell2 As Range
  Dim DVCell3 As Range
  Dim DVCell4 As Range
  Dim DVRange1 As Range
  Dim DVRange2 As Range
  Dim DVRange3 As Range
  Dim DVRange4 As Range
  Dim DVListItem1 As Range
  Dim DVListItem2 As Range
  Dim DVListItem3 As Range
  Dim DVListItem4 As Range
  Dim Path As String
  
  Path = &quot;C:\MyFiles\&quot;
  
  Set wb = ThisWorkbook
  Set ws = wb.Worksheets(&quot;Template_view&quot;)
  Set DVCell1 = ws.Range(&quot;C6&quot;)
  Set DVRange1 = Evaluate(DVCell1.Validation.Formula1)
  Set DVCell2 = ws.Range(&quot;F6&quot;)
  Set DVRange2 = Evaluate(DVCell2.Validation.Formula1)
  Set DVCell3 = ws.Range(&quot;C7&quot;)
  Set DVRange3 = Evaluate(DVCell3.Validation.Formula1)
  Set DVCell4 = ws.Range(&quot;F7&quot;)
  Set DVRange4 = Evaluate(DVCell4.Validation.Formula1)
  
  
  For Each DVListItem1 In DVRange1
      DVCell1 = DVListItem1
          For Each DVListItem2 In DVRange2
              DVCell2 = DVListItem2
                  For Each DVListItem3 In DVRange3
                      DVCell3 = DVListItem3
                          For Each DVListItem4 In DVRange4
                              DVCell4 = DVListItem4
                              ws.Copy
                              Set nwb = ActiveWorkbook
                              Set nws = nwb.Worksheets(&quot;Template_view&quot;)
                                              
                              With nws
                              Cells.Copy
                              Cells.PasteSpecial (xlPasteFormulas)
                              End With
                                              
                              Application.DisplayAlerts = False
                              nwb.SaveAs Filename:=Path &amp; DVListItem1 &amp; DVListItem2 &amp; DVListItem3 &amp; DVListItem4 &amp; &quot;.xlsx&quot;, FileFormat:=xlWorkbookDefault
                              nwb.Close
                              Application.DisplayAlerts = True
                      
                          Next DVListItem4
                  Next DVListItem3
          Next DVListItem2
  Next DVListItem1
  
  End Sub
  </code></pre>