Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, Probably very simple but not for me! Have searched for similar
examples but haven't found anything that I will find easily "Tweak-able"! 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) B100010 R12 099998 099999 101311 B100505 R11 101313 101315 101317 101319 101501 101503 B20902 R41 101505 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 :-) |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub Test()
Dim iLastRow As Long Dim i As Long iLastRow = Cells(Rows.Count, "C").End(xlUp).Row For i = 2 To iLastRow If Cells(i, "A").Value = "" Then Cells(i, "A").Value = Cells(i - 1, "A").Value Cells(i, "B").Value = Cells(i - 1, "B").Value End If Next i End Sub -- HTH Bob Phillips (remove xxx from email address if mailing direct) "BeJay" wrote in message ups.com... Hi, Probably very simple but not for me! Have searched for similar examples but haven't found anything that I will find easily "Tweak-able"! 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) B100010 R12 099998 099999 101311 B100505 R11 101313 101315 101317 101319 101501 101503 B20902 R41 101505 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 :-) |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Bob - great help.
|
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Bob - great help.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to put a loop in a macro? | New Users to Excel | |||
Loop time seems dependent on unrelated workbook - Why? | Excel Worksheet Functions | |||
Loop gone crazy | Excel Discussion (Misc queries) | |||
Do Loop | Excel Discussion (Misc queries) | |||
loop trough e-mail address list to send task lists with outlook | Excel Discussion (Misc queries) |