Script skips rows

Argentina09

New Member
Joined
Feb 13, 2017
Messages
7
Code:
[COLOR=#333333][FONT=&quot]
Why does excel start to skip rows after a while in an excelsheet when running a VBA script?
 What could be the mistake in the script andwhat could be possible solutions? <o:p></o:p>[/FONT][/COLOR]
[FONT=&quot]Many thanks for answers on this. <o:p></o:p>[/FONT]
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi

Well its not normal behaviour.
Could be multiple things going on.
I think everyone will want to see your code to comment.

Dave
 
Upvote 0
Hi

Well its not normal behaviour.
Could be multiple things going on.
I think everyone will want to see your code to comment.

Dave

Hello.
Code:
Unfortunately, the code cannot be posted here. Sorry about this. 
What should one check for when the vba script skps rows?
 
Upvote 0
Well. I fear it will be impossible to answer.

But, for example.

A loop with an if statement. Mixed with an offset on if true.

But it really I feel I will be unable to help without the code.

Dave
 
Upvote 0
The first thing I think of when I hear this is that it's a script that is deleting rows.
If this is what you are doing then you want to move backward through the rows not forward and this is why.

Take this simple example:

Code:
For x=1 to 10
If Range("A" & x)=7 then Rows(x).Delete
Next x

Now if row 2 was 7 it would delete that row, which would now contain what used to be in row 3. Now when the loop increments it will go to 3, which is now what used to be row 4 because of the deletion.

To modify my example to work correctly:
Code:
For x=10 to 1 Step -1
If Range("A" & x)=7 then Rows(x).Delete
Next x

Now if row 2 was 7, it would delete row 2, moving up all rows after and then the loop would move to 1 which still contains its original contents.
 
Upvote 0
Unless you post the code or give a good description of what the code does how do you expect to get a relevant response?
 
Upvote 0

Forum statistics

Threads
1,215,578
Messages
6,125,642
Members
449,245
Latest member
PatrickL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top