Hi
I have the following code:
but it won't get out of the first if condition and I cannot see why...![]()
Please Login or Register to view this content.
any ideas please?
Thanks in advance!![]()
Hi
I have the following code:
but it won't get out of the first if condition and I cannot see why...![]()
Please Login or Register to view this content.
any ideas please?
Thanks in advance!![]()
Maybe explain what the code is supposed to do, and post the workbook.
Also, you probably want to reenable events and updating before exiting the code.
Entia non sunt multiplicanda sine necessitate
Hi,
this code is used in between 4 sheets in my workbook (it has 16 in total so there is a lot of info in it that's why I did not post it)
The sheet called "Race Results" contains row data given to me by the time keepers after a race.
It contains an ID number, the number of the car, the number of the lap, the name of the driver in the car at the time, the 3 sector times, the lap time, the max speed achieved in the lap and a marker (1 to 7) to indicate which stint the car is in (a stint is all the laps in between two pit stops) all that in column A to J
the above code looks in Race Results in a table in K,L where I manually put the final race classification.
So it looks for the number of the first car to finish the race in L1 (to L6) then looks for it in the row data (which would be in column C, the data comes ordered by car number and not final classification), then on the same row it looks for the marker 1-7 (in column J) and copies the name of the driver (in column D) to the other sheets.
once found the right driver for the right stint and car it copies it in the three other sheets "Stint Analysis", "Pit Stops" and "Stints" which are used for post-race analysis.
and that's all the code is doing.
In Stint Analysis, each car has a 24 row "area", each stint being every 4 rows starting in row 3. the driver's name is put in D4, D8, D12... D22 for the first car. then it jumps from D28 to D46 for the second one, etc...
in Pit Stops, each car has a 3 column area. Each stint is on four rows again. This sheet only displays in and out laps (pit stops). for each of them the name of the driver is displayed in column C, F, I, L, O and R depending on the car.
so for my first car the first driver in is in C4 (in lap), then the second driver is in C7 (out lap) and C8 (in lap), the next driver to drive is in C11 and C12, ... until C27 and C28
then next car in F with the same row numbers.
In Stints, each car has a seven column area, each of them being for one stint. The name of the driver driving a stint is displayed in row 3 of whichever column.
the code does not leave the first if condition by itself, meaning I have to press esc to make it stop. However everything it was supposed to do is done very quickly (all the data is entered in all the sheets where it should be), it just stays stuck in the end if until I press esc.
I hope this helps
(the reenabling events and updating is done later on in the sub, in code I took away, it is code happening after this bit and not influencing it)
I don't think I can help without seeing the workbook -- but you should be able to set a breakpoint on an early line of code (F9), and then single-step (F8) to find the problem.
If you say so...
here it is, very simplified, it only contains the worksheets mentioned in the code and only the part of the row data necessary for the code so the information needed is the only information displayed.
it can't be clearer.
Thank you in advance if you can help me!![]()
hi,
I can't provide thorough help because I'm currently using Excel 2000 & can't open xlm files.
However I have noticed that your code may not be working as intended. The below two lines of code suggest that you want sRow to loop from row 2 to the last populated row of the Race Results column D, whereas it is actually checking column D of the active sheet (is it the right sheet?) because the range isn't explicitly referenced.
If there is no data below D2, this will keep looping until it has gone through the million rows (in Excel 2007).![]()
Please Login or Register to view this content.
hth
Rob
Rob Brockett
Kiwi in the UK
Always learning & the best way to learn is to experience...
well thank you! because it was the thing that bugged it! I didn't see I forgot the dot, I used this line before and the dot is there and I guess I just read a dot that was not there!I could have kept looking for a long time as I was looking for something totally different...
however there was data below D2 and it kept looping anyway, it was doing all it was supposed to do and then stayed stuck, I guess in the empty rows following my data?
Thanks very much![]()
Hi,
I have another question which I know I should put in another thread but I cannot manage to create a new one, when I click submit new thread I only get a blank page all the time and when I come back to the forum by retyping the link my thread is not there so please excuse me in advance for putting it here:
I have used the recorder to code an autofilter in a macro. Then the code copies the rows left out by the filter and copies them to another sheet.
It works well but the range to select and copy is physically defined in my code because I selected it manually when I recorded the code.
How can I code "select all the rows left out by the autofilter"? so I can apply my code to any kind of data? (the length of the range changes)
(I tried autofilter.range.select found in the help but it would not work...)
Many thanks in advance!![]()
Hi Astrid,
Yes, you're right it should be in a new thread but because you can't here you are...
If you've been able to start a new thread can you please link it to my below answer?
HAve a look at post 3 by Joel of this link: http://www.pcreview.co.uk/forums/sho...98&postcount=3
hth
Rob
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks