Fill blank cells with cells above data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top