copy numbers from previous row.

donlincolnmre2

Board Regular
Joined
Dec 23, 2006
Messages
142
Hello

I'm looking for a macro which has some number in Column D

If the Column D row contains a blank Cell then the macro should copy the value from the previous row into that current cell

like in the data below, row 2 contains the empty cell so it should copy the value from row 1 column D to row 2 column D

Any help would be greatly appreciated.

Thanks.



column C Column D
======= ========
PLEASANT HILL 544185
Pleasant Hill
OAKLAND 240000
LODI 272000
Lodi
DALY CITY 435000
COTO DE CAZA 1215000
RANCHO PALOS 1074500
RANCHO SANTA 844700
Unknown 7800000
RICHMOND 344491
Richmond
Richmond
Richmond
RICHMOND 371700
LODI 212000
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Sub Macro1()
'
' Macro1 Macro
'

'
Columns("D:D").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
End Sub


Alternatively, you could manually do this by:
1. Select col D
2. Press F5 function key
3. click "Special" box
4. place a check next to "Blank" then click OK
5. Press the = sign, then press the up arrow once
6. Press CTRL-Enter keys together (don't just press the enter key)
 
Upvote 0

Forum statistics

Threads
1,196,323
Messages
6,014,637
Members
441,833
Latest member
Rangerreeve

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