Yes to be honest, I had hit a brick wall with this and was just trying anything to get an understanding of making a search or comparison function. This application is for entering data to track fuel and tyres in a pit lane during events, so the UI had to be super simple so as not to distract engineers and technicians, it is also customer facing, so had to be a little on the smoke and mirrors side of things. The thing is, they all loved it and realized this was much more acurate than using a quill and parchment and now the engineers have asked for a summary page so they can view the data during the event. So I need to loop through 5 rows of 5 possible sets of tyres (If it rains they will change to wets and then when it drys again, they will go back to the previous set, it’s a cost thing) so I am going to try a more simple approach of a simple loop and if statement, but I still have to find the correct syntax I had something like this in mind:
Sub Summary(iKilometers) ' iKilometers is the Kilometers of the last run pre calculated
Dim gsTyres As String '
Dim tSearch As string ' Tyre set being changed to
Dim iTyreLife As Integer
Dim j As Integer
Doc = ThisComponent
runSheet = Doc.Sheets(0)
sumSheet = Doc.Sheets(1)
'Summary sheet uses a box of 3 colums by 5 rows the columns are are tyre set, time, and tyre life(miles)
For j = 1 to 5
If tyreSet = tSearch then
iTempKm = sumSheet.getCellByPosition(3, j).Value
iTyreLife = iTempKm + iKilometers
sumSheet.getCellByPosition(2, j).String = TIME() ' Time Stamp, date is dealt with
sumSheet.getCellByPosition(3, j).Value = iTyreLife
Break out of loop somehow ' This is another bit of syntax I simply can't find
Else
NewRow() ' returns i as new row value in current sheet
sumSheet.getCellByPosition(1, i).String = gsTyres ' global value for tyres currently on the car
sumSheet.getCellByPosition(2, i).String = TIME()
sumSheet.getCellByPosition(3, i).Value = iKilometers
End If
Next i
End Sub
Actually I have just written this now, and it is nearly there, it just needs a couple of bits of syntax and any comments about improvement to this will be taken on board, I am as I mentioned currently still just learning to program, and good programming practices are always noted.
Kind regards
iFunct