JJanower
10-21-2011, 04:48 AM
Hey guys,
I am sure this is a very easy question to answer for most of you, but i just can t find the right code.
Private Sub CommandButton3_Click()
Dim StartTime As Date
Dim EndTime As Date
For i = 2 To 146 'end of the sheet1 team/name
For j = 3 To 15 'end of sheet1 dates
TempData = Worksheets("Sheet1").Cells(1, j) & Worksheets("Sheet1").Cells(i, 2)
k = 2
Do While Cells(k, 1) & Cells(k, 4) = TempData
StartTime = Cells(k, 5)
EndTime = Cells(k, 9)
Worksheets("Sheet1").Cells(i, j) = StartTime & "-" & EndTime
k = k + 1
Loop UNTIL k= 300
Next j
Next i
End Sub
I need this thing to loops until k = 300,, but obviuosly is not the correct way to express it in VBA, if you could give me a tipp I would appreciate it.
I am sure this is a very easy question to answer for most of you, but i just can t find the right code.
Private Sub CommandButton3_Click()
Dim StartTime As Date
Dim EndTime As Date
For i = 2 To 146 'end of the sheet1 team/name
For j = 3 To 15 'end of sheet1 dates
TempData = Worksheets("Sheet1").Cells(1, j) & Worksheets("Sheet1").Cells(i, 2)
k = 2
Do While Cells(k, 1) & Cells(k, 4) = TempData
StartTime = Cells(k, 5)
EndTime = Cells(k, 9)
Worksheets("Sheet1").Cells(i, j) = StartTime & "-" & EndTime
k = k + 1
Loop UNTIL k= 300
Next j
Next i
End Sub
I need this thing to loops until k = 300,, but obviuosly is not the correct way to express it in VBA, if you could give me a tipp I would appreciate it.