I have a spreadsheet like so:
lines.png
I have 20 blocks like the one above, and I would like to create a macro which does the following:
1. Ask user how many rows to add. Entry must be less than or equal to the Current No. of rows minus 3 as per the grey filled cell in column C of that block. This can be done by reading the value in the first grey-filled cell of column C moving downward from the current mouse location.
2. Copy # of rows from step 1
3. "Insert copied cells" two rows from the grey line of that block.
Using the above image as an example:
I have 28 rows total.
I run the macro, and a message box asks me how many rows to add, with a note saying that I cannot add more than 25 rows (28-3).
I enter 28. I get an error message saying I cannot add more than 25 rows, and it asks me to enter again.
I enter 24.
Rows are selected and copied from Row 3 (one row below the top row of the block) to Row 26 (Row 3 plus # of rows entered)
Copied rows are inserted as "Insert Copied Cells" command (To maintain formulas/formatting etc.) below the last copied row. So, in this case, these rows will be copied starting at Row 27.
If this was done manually:
Selecting entered cells (24)
select.png
Copying selected cells:
copy.png
Insert Copied cells:
insert.png
Bookmarks