title: loop through worksheet with different names using VBA
body: <pre><code>Dim Var_1 As String
  Dim Var_2 As String
  Dim Var_3 As String
  Dim Var_4 As String
  Dim Var_5 As String
  Dim Var_6 As String
  Dim Var_7 As String
  Dim Var_8 As String
  Dim Var_9 As String
  Dim Var_10 As String
  Dim Var_11 As String
  Dim Var_12 As String
  Dim Var_13 As String
  Dim Var_14 As String
  Dim Var_15 As String
  Dim Var_16 As String
  Dim Var_17 As String
  Dim Var_18 As String
  Dim Var_19 As String
  Dim Var_20 As String
  Dim Var_21 As String
  Dim Var_22 As String
  Dim Var_23 As String
  Dim Var_24 As String
  Dim Var_25 As String
  Dim Var_26 As String
  Dim Var_27 As String
  Dim Var_28 As String
  Dim Var_29 As String
  
  Var_1 = "Ex-Bidadi"
  Var_2 = "Ex-Hospet"
  Var_3 = "Ex-Chennai"
  Var_4 = "Ex-Coimbatore"
  Var_5 = "Ex-Gangaikondan"
  Var_6 = "Ex-Pune"
  Var_7 = "Ex-Goa"
  Var_8 = "Ex-Mumbai"
  Var_9 = "Ex-Nashik"
  Var_10 = "Ex-Aurangabad"
  Var_11 = "Ex-Goblej"
  Var_12 = "Ex-Hyderabad"
  Var_13 = Ex - Vizag
  Var_14 = "Ex-Vijayawada"
  Var_15 = "Ex-Chittoor"
  Var_16 = "Ex - Siliguri"
  Var_17 = "Ex-odhisha"
  Var_18 = "Ex-Jharkhand"
  Var_19 = "Ex-Bihar"
  Var_20 = "Ex-NorthEast"
  Var_21 = "Ex-Delhi"
  Var_22 = "Ex-Udaipur"
  Var_23 = "Ex-Jammu"
  Var_24 = "Ex-Haridwar"
  Var_25 = "Ex-Dasna"
  Var_26 = "Ex-Kanpur"
  Var_27 = "Ex-Unnao"
  Var_28 = "Ex-Var_anasi"
  Var_29 = "Ex-Bhopal"
  </code></pre>
  
  <p>I am showing you a part of my code and i just want to known how to loop these I tried using this representation </p>
  
  <pre><code>For n = 1 to 29
      For i = 3 To 445
          For m = 28 To 40
              ActiveWorkbook.Sheets("Var_" &amp; n).Cells(i, m) = 999999
              least(i, m, n) =  ActiveWorkbook.Sheets("Var_" &amp; n).Cells(i, m)
          Next m
      Next i
  Next n
  </code></pre>
  
  <p>I have defined the least(i,m,n) array but the loop is showing an error at the subscript is out of Range I have tried using all the possibilities but the loop doesn't work</p>