Solved

# Populate blank cells with cell above

Posted on 2015-02-04
55 Views
Hello,

There are many blank cells
basically i drag down the cell above up but not including the next populated cell below and continue the process until done.
this is tedious and time consuming if you have many blank cells in hundreds of rows.

how can I use a formula for this?

Populate-EE.xlsx
0
Question by:pdvsa

LVL 24

Expert Comment

ID: 40588821
I don't know what you mean.

However, if you want to fill in blank cells:

2. Filter on blanks "(blank)".
3. In the first blank cell - let's say it's A2:
a. If you wanted the cell above, enter =A1
b. If you wanted the cell below, enter = A3
4. Copy this cell.
5. Paste it into all of the other blank cells.

That will populate an entire column at once without overwriting cells which already have information.
0

LVL 46

Expert Comment

ID: 40588883
Here's a macro

``````Sub FillEm()
Dim lngLastRow As Long
Dim lngLastColumn As Long
Dim lngRow As Long
Dim lngCol As Long

lngLastColumn = Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlPrevious).Column
lngLastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For lngRow = lngLastRow To 2 Step -1
For lngCol = 1 To lngLastColumn
If Cells(lngRow, lngCol) = "" Then
Cells(lngRow, lngCol) = Cells(lngRow - 1, lngCol)
End If
Next
Next

End Sub
``````
0

LVL 33

Accepted Solution

Norie earned 500 total points
ID: 40589037
1 Select column A.

2 Goto Find & Select>Goto Special....Blanks.

3 Type =A2 in the formula bar and confirm with CTRL+ENTER.

4 Optional. Select column A, copy and paste special values.

If you want code.
``````Sub FillBlanks()
With Range("A:A")
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
.Value = .Value
End With
End Sub
``````
0

Author Closing Comment

ID: 40589107
nery nice.
0

Author Comment

ID: 40589170
Philip, I Reread  your answer and I think you are essentially stating what Norie has stated  however I think Norie has a slightly different solution with finding blanks and replacing with cell above.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as tâ€¦
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabilâ€¦
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.