Remove Rows without formatting or Values

Jon.r

New Member
Joined
Aug 2, 2011
Messages
1
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:

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)

h4Dcb.png


Any help much appreciated!
thank you!
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top