G
Guest
Can anyone tell me why sometimes this code should fail on line 5 with y=0 ...
1 Private Sub PopulatecmbGrades()
2 Dim y As Single
3 With Sheets("Sheet5")
4 For y = 3 To .[H3].CurrentRegion.Rows.count
5 cmbGCodes.AddItem .Cells(y, 8)
6 cmbGrades.AddItem .Cells(y, 9)
7 Next
8 End With
9 cmbGCodes.ListIndex = 0
10 cmbGrades.ListIndex = 0
11 End Sub
.[H3].CurrentRegion.Rows.count = 13 currently
I do use y elsewhere and it may be 0 but a) it would be out of scope here
and b) it should be set by the For loop.
1 Private Sub PopulatecmbGrades()
2 Dim y As Single
3 With Sheets("Sheet5")
4 For y = 3 To .[H3].CurrentRegion.Rows.count
5 cmbGCodes.AddItem .Cells(y, 8)
6 cmbGrades.AddItem .Cells(y, 9)
7 Next
8 End With
9 cmbGCodes.ListIndex = 0
10 cmbGrades.ListIndex = 0
11 End Sub
.[H3].CurrentRegion.Rows.count = 13 currently
I do use y elsewhere and it may be 0 but a) it would be out of scope here
and b) it should be set by the For loop.