I've written nested For loops and even though the conditions are met it is not executing the code of the For loops. I tried commenting out the outermost For loop but the inner loop doesn't work either. I'm working in Excel 2007
Sub CalcAll()
Dim a As Integer
a = 10
Dim b As Integer
b = 10
For a = 10 To a = (Range("B" & Rows.Count).End(xlUp).Row) Step 1
For b = 10 To b = (Worksheets("DistanceLookupTable").Cells(2, Sheet1.Columns.Count).End(xlToLeft).Column) Step 1
If IsEmpty(Cells(a, i).Value) Then
Exit Sub
Else
'Lots of code reading values from the worksheet and printing
'calculated values to the worksheet
End If
Next b
Next a
End Sub
Thanks for your help
Cells(a, i)but nowhere isidefined. Should beCells(a, b)?