Hi guys,
I'm trying to use for next loop, on button click it should check the value from the cell R2, and according to the value of the cell to show the next value from the list in column O in label. Bellow you can find the loop which I used, but it's showing the value from the list in column O. Also when the loop reach the last value from the list it should start from the first value from the list again.
Can you please help me with this?
I'm trying to use for next loop, on button click it should check the value from the cell R2, and according to the value of the cell to show the next value from the list in column O in label. Bellow you can find the loop which I used, but it's showing the value from the list in column O. Also when the loop reach the last value from the list it should start from the first value from the list again.
Can you please help me with this?
VBA Code:
Private Sub nextButton_Click()
Dim brojPolja As Long
Worksheets("Sheet1").Cells(2, 18).Value = imeLabel.Caption
brojPolja = Sheet1.Cells(Rows.Count, 15).End(xlUp).Row
For i = 2 To brojPolja
imeLabel.Caption = Worksheets("Sheet1").Cells(i, "O").Value
Next
End Sub