Copying down data into blank lines

christinead

New Member
Joined
Jun 7, 2007
Messages
23
Hi all you wonderful Excel buffs...I need some help!
I have a 30000 line spreadsheet which has a massive amount of data in it.

In the rows there is information which I need to copy down to the blank rows directly below, for example every third row might have data in it which I want to copy to the blank cells below.
I am after an easy way of copying down the data instead of manually having to do it, as there is 30000 lines!
Can someone out there assist me.
If you dont understand my rambling above, I have done a little example above

Cell
A1 Dog
A2 (how do i copy dog into this cell)
A3 (how do i copy dog into this cell_
A4 Cat
A5 (how do i copy cat into this cell)
A6 (how do i copy cat into this cell)

Yes, I know about copying and pasting, but I want to do it all in one go!!!
Thanks
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Maybe not the best way to work a cell at a time but should work:
Code:
Sub FillEmptyCells()

Dim c As Range
Dim Rng As Range

Application.ScreenUpdating = False

Set Rng = Selection  'Define the range you want to work on

For Each c In Rng.SpecialCells(xlCellTypeBlanks)
'Writing just the values:
'    With c
'        .Value = .Offset(-1, 0).Value
'    End With
    
'Or if you prefer copying:
    With c.Offset(-1, 0)
        .Copy c
    End With
Next c

End Sub
 
Upvote 0
Maybe this code?
Code:
Sub fillblanks()
Dim e As Range
For Each e In ActiveSheet.UsedRange.Rows
If Application.CountA(e) = 0 Then e.Value = e(0).Value
Next e
End Sub
 
Upvote 0
thanks so much guys, I am off to a work meeting now, but will eb back bright and early Monday morning trialling it all!!!!
will undoubtedly have questions then...

cheers
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,151
Members
452,891
Latest member
JUSTOUTOFMYREACH

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