close

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.

PetePete - thank you so much, this worked!

quot;Petequot; wrote:

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

Glad to help - thanks for getting back.

PeteTry this function:

Sub FillDown() Range(quot;B2quot;).Select Range(Selection, Selection.End(xlDown)).Select Range(quot;B4:B1000quot;).Select Selection.SpecialCells(xlCellTypeBlanks).Select Selection.FormulaR1C1 = quot;=R[-1]Cquot;
End Sub

Note: B2 whould be the first cell in the column that contains data; adjust
range to suit--
RyGuyquot;Petequot; wrote:

gt; Glad to help - thanks for getting back.
gt;
gt; Pete
gt;
gt;

Whoops, I meant to say subroutine, not function...........

--
RyGuyquot;Petequot; wrote:

gt; Glad to help - thanks for getting back.
gt;
gt; Pete
gt;
gt;

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

Pete

On Feb 6, 3:40 am, ryguy7272 gt;
wrote:
gt; Whoops, I meant to say subroutine, not function...........
gt;
gt; --
gt; RyGuy
gt;
gt;
gt;
gt; quot;Petequot; wrote:
gt; gt; Glad to help - thanks for getting back.
gt;
gt; gt; Pete- Hide quoted text -
gt;
gt; - Show quoted text -
Hi Pete - Do you know how to run it on a different row each time?

quot;Pete_UKquot; wrote:

gt; You do realise that this thread was from a year ago ??
gt;
gt; Pete
gt;
gt; On Feb 6, 3:40 am, ryguy7272 gt;
gt; wrote:
gt; gt; Whoops, I meant to say subroutine, not function...........
gt; gt;
gt; gt; --
gt; gt; RyGuy
gt; gt;
gt; gt;
gt; gt;
gt; gt; quot;Petequot; wrote:
gt; gt; gt; Glad to help - thanks for getting back.
gt; gt;
gt; gt; gt; Pete- Hide quoted text -
gt; gt;
gt; gt; - Show quoted text -
gt;
gt;
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()