Code Snippet - Solution Suggestions

G

Gav !!

Folks

I have included part of the code ( extract ) I hope it is not too big, but
only to try and explain what I am trying to achieve :

This works for 90% of my data - the problem being the other 10% doesn't
conform to the same route rules and each one is different not only to this
but to each other, we are talking initially up to 30 variations. Is there an
easier way to do these others or am I going to have to duplicate this code
for every anomoly ????

There can be up to 10 routes of which I am only interested in a start,
intermediate and end timestamp through the routes of which most locations
conform to the below rule, the others could be any route number for those 3
events between 1 and 10.
The runnings sheet lists cols A-C - Loc Name, Route, Datetime I then take
these from each other using formulas in cols D,E & F to give actual running
times.

loc is a location name
route is a number / string between 1 & 10
dtetme is a datetime timestamp

Sheets("sheet1").Activate
Range("A7").Select

Do
If ActiveCell.Offset(0, 6).value = "U" _
And ActiveCell.Offset(0, 8).value = "0" _
And ActiveCell.Offset(0, 10).value <> "" _
And ActiveCell.Offset(0, 11).value <> "" Then

loc = ActiveCell.Offset(0, 9).value
route = ActiveCell.Offset(0, 10).value
dtetme = ActiveCell.Offset(0, 2).Text

Sheets("runnings").Activate
Range("A3").Select

loccount = 0
Do Until loccount = 1 Or ActiveCell.value = ""

If ActiveCell.value = loc Then
loccount = locount + 1

Select Case route

Case 1
ActiveCell.Offset(0, 2).value = dtetme
Case 4
ActiveCell.Offset(0, 3).value = dtetme
Case 8
ActiveCell.Offset(0, 1).value = dtetme
Case Else
End Select
Else
ActiveCell.Offset(1, 0).Select
End If
Loop

Sheets("sheet1").Activate
ActiveCell.Offset(1, 0).Select

Thanks in advance

Gav !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top