powersp68232
New Member
- Joined
- Apr 24, 2018
- Messages
- 12
I have data like the image below. I am trying to select a range from Cell B7 to Cell B908, Do Something, Select range B909 to B1807, Do Something, and continue this loop until I get to the last row of data. The cycle runs about 45sec each time, but there are always multiple instances of the time stamp. So, I am needing to be able to select the last row with that timestamp and then create a loop to complete the same on each cycle.
Ex.
Ex.
VBA Code:
Private Sub Find_Range_Time()
Dim sTime As Range, fTime As Range, Total As Integer, LastRow As Long
'Set range with initial start time.
sTime = Range("B7")
'Find last cell with Finish Time
'This should locate the last cell that contains the finish time of the current cycle
'All cycles are 45 seconds
<code here>
'Do this loop on current cycle range
Total = (LastRow / 45) / 20
i = 1
For i = i To LastRow
Set Chart = Range("C" & sTime, "C" & fTime)
'Set sTime to cell fTime with offset of 1
sTime = fTime.Offset(1, 0)
Next i
End Sub