close

Hi, Probably very simple but not for me! Have searched for similar
examples but haven't found anything that I will find easily
quot;Tweak-ablequot;! I need some help with a loop that needs to copy data
down blank cells in a column until there is new data there again.

Details:- I have a column A populated with an order number, column b
with an area code and column c with individual item lines. The amount
of item lines may be different for each separate order. I need the
order number and area number to be copied down the blank cells until
the next order number, which is then to be copied down to the next one
and so on. (same for area code)

B100010R12099998
099999
101311
B100505 R11 101313
101315
101317
101319
101501
101503
B20902R41101505
101507
101509
101511
101513
101515

Can I define a macro to do this? Otherwise I will be going into some
pretty un-chartered VBA territory. I assume there may need to be loop
statement ( which I could probably cope with - just about!) but am
struggling to work out how I tell it to copy into the blank cells, the
text from the last cell in that column that wasn't blank.

Anybody Help??? Thanks in advance :-)Sub Test()
Dim iLastRow As Long
Dim i As Long

iLastRow = Cells(Rows.Count, quot;Cquot;).End(xlUp).Row
For i = 2 To iLastRow
If Cells(i, quot;Aquot;).Value = quot;quot; Then
Cells(i, quot;Aquot;).Value = Cells(i - 1, quot;Aquot;).Value
Cells(i, quot;Bquot;).Value = Cells(i - 1, quot;Bquot;).Value
End If
Next i

End Sub
--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

quot;BeJayquot; gt; wrote in message ups.com...
gt; Hi, Probably very simple but not for me! Have searched for similar
gt; examples but haven't found anything that I will find easily
gt; quot;Tweak-ablequot;! I need some help with a loop that needs to copy data
gt; down blank cells in a column until there is new data there again.
gt;
gt; Details:- I have a column A populated with an order number, column b
gt; with an area code and column c with individual item lines. The amount
gt; of item lines may be different for each separate order. I need the
gt; order number and area number to be copied down the blank cells until
gt; the next order number, which is then to be copied down to the next one
gt; and so on. (same for area code)
gt;
gt; B100010 R12 099998
gt; 099999
gt; 101311
gt; B100505 R11 101313
gt; 101315
gt; 101317
gt; 101319
gt; 101501
gt; 101503
gt; B20902 R41 101505
gt; 101507
gt; 101509
gt; 101511
gt; 101513
gt; 101515
gt;
gt; Can I define a macro to do this? Otherwise I will be going into some
gt; pretty un-chartered VBA territory. I assume there may need to be loop
gt; statement ( which I could probably cope with - just about!) but am
gt; struggling to work out how I tell it to copy into the blank cells, the
gt; text from the last cell in that column that wasn't blank.
gt;
gt; Anybody Help??? Thanks in advance :-)
gt;
Thanks Bob - great help.Thanks Bob - great help.

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

    software

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