I've searched through the forum, but can't find any help.
It's fairly basic, but I've got a long list of entries, but with a few gaps in. Is there an easyway to get a macro to go down the list and where there' a gap in the list to copy the contents from the line below?
Copy From Line Below
-
-
-
Re: Copy From Line Below
Hello!
Theres a few things that need to be cleared out. If you have empty rows in your document, how many emty rows are there together (if its just one empty row at once, or if there can be several empty rows after each other).
I did a quick and dirty little script that can do this, but it assumes there can only be one empty row at once. If it finds two empty rows it will stop.
Code
Display MoreOption Explicit Sub FillBlanks() Dim i As Integer Dim EmptyRows As Integer i = 1 Do While Not EmptyRows > 2 If Cells(i, 1).Value = Empty Then EmptyRows = EmptyRows + 1 Rows(i + 1).Copy Cells(i, 1).Select ActiveSheet.Paste Else EmptyRows = 0 End If i = i + 1 Loop End Sub
Can probably be done better, but it works anyway as long as theres only one empty row between filled rows.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!