You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[
^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^]
Put a
Breakpoint
at beginning of the routine that add rows. see how many time your routine is called (and for which WorkSheet).
Set some
WhatchPoint
to track the number of rows of each WorkSheet. This feature allow you to track a formula; The formulas should look like
WorkBook.WorkSheet(1).Rows.Count
and
WorkBook.WorkSheet(2).Rows.Count
.
And see when things go wrong.