Hi ZmeY
Difficult to see what you are trying to achieve here. Are you trying to scroll down a list of values and insert a row between two that are different? e.g.:
1
1
1
<----Insert here
2
2
2
Anyway - some pointers on the code:
You don't need to select something to look at it. You can just refer to its address, or location:
The Rows command requires numbers, or a string. Unfortunately, "row:row2" will not be evaluated correctly. You could build the string:
strRows = Format(row,"0") & ":" & format(row2,"0")
Kind of messy. In this case, since row2 is always 2 rows beneath row, you could use:
To list through a range of cells, try this:
However, for inserting rows this all gets a bit tricky, as when you insert a row it affects the following rows. You end up in a perpetual loop.
So, start at the bottom and work your way up. Use row numbers, not cells/ranges, as these don't move about. If you insert a row then move above it, you know where you are and the rows you're now working on won'y have been affected by the previous insertion.
Hope some of this helps.
Cheers, Rob.
Bookmarks