Hello, I have a bit of an issue with a macro automating rows and removing them based on the surrounding rows.
I have several rows structured like this (also picture below):
Edit: I guess it is important to note that each *data block* has several merged cells that have a border that kind of throws a twist into the mix
*data (formula or formatting)* <---1st ROW
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*data (formula or formatting)*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*data (formula or formatting)*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*data (formula or formatting)*<---ROW X
I would like it so each *data (formula or formatting)* has, at maximum 2 empty rows between it and the last/next row
I have some pseudo code here, but I haven't been able to pull it off:
I have attached an image of the /data/blanks that I have (I would like to shrink the red arrows to just 2 blank rows)
Any help much appreciated!
thank you!
I have several rows structured like this (also picture below):
Edit: I guess it is important to note that each *data block* has several merged cells that have a border that kind of throws a twist into the mix
*data (formula or formatting)* <---1st ROW
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*data (formula or formatting)*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*data (formula or formatting)*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*empty with no formatting or formulas*
*data (formula or formatting)*<---ROW X
I would like it so each *data (formula or formatting)* has, at maximum 2 empty rows between it and the last/next row
I have some pseudo code here, but I haven't been able to pull it off:
Code:
For each row in range (from 1 to X)
IF the row and the preceeding 2 rows are blank (no formula or formatting) THEN
Delete it
END IF
Loop
I have attached an image of the /data/blanks that I have (I would like to shrink the red arrows to just 2 blank rows)
Any help much appreciated!
thank you!
Last edited: