Fill blank cells with cells above data

M

Mary

I have a spreadsheet with that I recorded a macro to copy several adjacent
cell data from the row above it, however, if I try re-using that macro it
uses the cell numbers in the original macro and not the new row I am working
on.

Is there a way of looking where my cursor is at and then copying the only a
certain number of cells from the row above it - not the entire row?

Appreciate the assistance and expertise as always.
Mary
 
P

Pete

When you record the macro you see a small box with two icons - one to
stop recording (on the left) and another to switch from absolute
references (default) to relative references. You should start recording
another macro and immediately click on the relative reference icon.
After recording you can view your code in the VBE editor and see the
differences.

Hope this helps.

Pete
 
R

ryguy7272

Try this function:

Sub FillDown()
Range("B2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("B4:B1000").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
End Sub

Note: B2 whould be the first cell in the column that contains data; adjust
range to suit
 
Top