I'm tracking problems with lorries for a weekly report.
I got three diffrent "kind" of lorries:
Lorries with numbers less than 3500.
Lorries with numbers above 4000.
Lorries with numbers going from 3500 to 3599.
There are nine defined problems that I track so the table will show how many times a particular problem has occured.
For the lorries with numbers less than 3500 and numbers above 4000 I can group these in one row.
For the lorries with numbers between 3500 and 3599 I have to report each lorry with a problem on a separate row.
My problem is that building the report for takes a bit of time (for lorries between 3500 and 3599) and I wonder if anybody has a suggestion for speeding it up.
Code for lorries with number less than 3500:
For k = 0 To 8
For Each Cell In Range("C110:C" & Range("C" & _Rows.Count).End(xlUp).Row)
If Cell.Value < 3500 And Cell.Offset(0, 1).Value =
_Cells(3, 3 + k).Value Then
Cells(5, 3 + k).Value = Cells(5, 3 + k).Value + 1
End If
Next
Next
Code for lorries with numbers above 4000 same as previous code except: Cell.Value > 4000
Code for lorries number 3500 to 3599:
For r = 0 To 99
For k = 0 To 8
For Each Cell In Range("C110:C" & Range("C" & _Rows.Count).End(xlUp).Row)
If Cell.Value = Cells(6 + r, 2).Value And Cell.Offset(0, _1).Value = Cells(3, 3 + k).Value Then
Cells(6 + r, 3 + k).Value = Cells(6 + r, 3 + _k).Value+ 1
End If
Next
Next
Next
Gratefull for any help on this problem.
Bookmarks