Delete Blank Rows and Loop or Do While

Chris Waller

Board Regular
Joined
Jan 18, 2009
Messages
183
Office Version
  1. 365
Platform
  1. Windows
I am using Excel 2013 and I need some help on a couple of my Spreadsheet.

I have blocks of data down the spreadsheet that are separated with a blank row. The data is of a variable length but currently the blocks stretch from A1 to approximately J1000 I would like to be able to delete the blank rows between the blocks of data and secondly on one of the spreadsheets there is some data from Column A to J, however the data in columns A to D appear only on the first row of each block of data.

As this information applies to the block of data concerned, this needs to be copied to all the rows within that block etc to the end of the data. I have tried creating a macro, however, I do not know how to make it loop or do while. Any help would be appreciated.

Thanks Again

Chris Waller
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
hi, Chris. maybe something like below. The on error resume next is to avoid errors if no blank cells are found
Code:
Sub back_up_first()

    On Error Resume Next
    
    With ActiveSheet.UsedRange.Columns("A:D")
        .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
        .Value = .Value
    End With
    
    Columns("E").SpecialCells(xlCellTypeBlanks).EntireRow.Delete


End Sub
 
Upvote 0
Fazza, Thanks for your prompt response. I thought there was a problem somewhere along the line as some of the text appeared "red" and some was left aligned and others were right aligned, however, I found that all the formatting was already on the worksheet. Thanks once again.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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