ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Fill blank cells with cells above data (https://www.excelbanter.com/excel-worksheet-functions/66930-fill-blank-cells-cells-above-data.html)

Mary

Fill blank cells with cells above data
 
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

Pete

Fill blank cells with cells above data
 
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


Mary

Fill blank cells with cells above data
 
Pete - thank you so much, this worked!

"Pete" wrote:

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



Pete

Fill blank cells with cells above data
 
Glad to help - thanks for getting back.

Pete


ryguy7272

Fill blank cells with cells above data
 
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


--
RyGuy


"Pete" wrote:

Glad to help - thanks for getting back.

Pete



ryguy7272

Fill blank cells with cells above data
 
Whoops, I meant to say subroutine, not function...........

--
RyGuy


"Pete" wrote:

Glad to help - thanks for getting back.

Pete



Pete_UK

Fill blank cells with cells above data
 
You do realise that this thread was from a year ago ??

Pete

On Feb 6, 3:40 am, ryguy7272
wrote:
Whoops, I meant to say subroutine, not function...........

--
RyGuy



"Pete" wrote:
Glad to help - thanks for getting back.


Pete- Hide quoted text -


- Show quoted text -




Heela

Fill blank cells with cells above data
 
Hi Pete - Do you know how to run it on a different row each time?

"Pete_UK" wrote:

You do realise that this thread was from a year ago ??

Pete

On Feb 6, 3:40 am, ryguy7272
wrote:
Whoops, I meant to say subroutine, not function...........

--
RyGuy



"Pete" wrote:
Glad to help - thanks for getting back.


Pete- Hide quoted text -


- Show quoted text -






All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com