Poundland
08-05-2015, 01:36 AM
Hi Guys,
Can anybody tell me why I am getting a Next without For Compile Error on the below code, as far as I can see each For Statement has a Next Statement to match!
Thanks in advance..
Sub results()
Sheets("Results").Select
Cells(2, 1).Select
Sheets("All").Select
Cells(5, 2).Select
Selection(Selection.End(xlToRight)).Select
CountMS = Selection.Count + 1
Cells(6, 1).Select
Selection(Selection.End(xlDown)).Select
CountStore = Selection.Count + 6
Cells(6, 1).Select
c = ActiveCell.Column
For a = 6 To CountStore
Cells(a, c).Select
Store = ActiveCell.Value
R = ActiveCell.Row
For b = 2 To CountMS
Cells(R, CountMS).Select
If ActiveCell.Value > 0 Then
GoTo AA
Else
Cells(5, CountMS).Select
Master = ActiveCell.Value
Sheets("Results").Select
ActiveCell.Value = Store
Selection.Offset(0, 1).Select
ActiveCell.Value = Master
Selection.Offset(1, -1).Select
Sheets("All").Select
AA:
Next b
End If
Next a
Can anybody tell me why I am getting a Next without For Compile Error on the below code, as far as I can see each For Statement has a Next Statement to match!
Thanks in advance..
Sub results()
Sheets("Results").Select
Cells(2, 1).Select
Sheets("All").Select
Cells(5, 2).Select
Selection(Selection.End(xlToRight)).Select
CountMS = Selection.Count + 1
Cells(6, 1).Select
Selection(Selection.End(xlDown)).Select
CountStore = Selection.Count + 6
Cells(6, 1).Select
c = ActiveCell.Column
For a = 6 To CountStore
Cells(a, c).Select
Store = ActiveCell.Value
R = ActiveCell.Row
For b = 2 To CountMS
Cells(R, CountMS).Select
If ActiveCell.Value > 0 Then
GoTo AA
Else
Cells(5, CountMS).Select
Master = ActiveCell.Value
Sheets("Results").Select
ActiveCell.Value = Store
Selection.Offset(0, 1).Select
ActiveCell.Value = Master
Selection.Offset(1, -1).Select
Sheets("All").Select
AA:
Next b
End If
Next a