I have a spreadsheet with block of data and empty rows in between. The blocks vary in size. I have a formula that auto fills the original data and then copies it over the other empty rows until it reaches the next block. How do I get it to Select the next block of data so that my loop can work, since the block’s size is always changing? What would be ideal is some kind of current region property that excludes the data behind the active cell, because the loop in it’s current state leaves the active cell as the first cell in the new block at the end of each iteration.
Share
Whenever I have to loop something that needs to move from region to region I end up using a combination of Offset (as in Range(myRange).Offset(1,0)) and usually a .End modifying to make sure I’m always at the end of the range. As an example (psuedo code).
Warning, I’m doing this off the top of my head, it may require some adjustment to actually work… Also, there are xlLeft, xlRight and clUP if you need to go in those directions.
Also, if you need to select a new range, you can do it by simply selecting a range by offset. My code might be kind of dirty (still new), but this should work.
If you start with neededCell at “D5”, that should return a range of “D5:X25”