if not empty do something

H

Helmut

I have order form based on info from catalogue.
If item not in catalogue, people will enter into bottom lines in column C.
IF one, two or more items were added, THEN I need to copy last cells from
column A and B and last cells from column G and H DOWN to as many rows as
there were new items added.
Hope this is clear. If someone could give me the code for this.
Thanks
Helmut
 
H

Helmut

Simon,
a) Yes, if anything is added...i.e. if more than one row added, then need
"loop"
b) No, let me try to explain:

H G F E D C B
A
XXXXXX XXXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX 15
NEW ITEM
16
NEW ITEM
17

IF NEW ITEM i.e. "B:15" = Empty, but "E16"=anything, THEN
copy "G&H:15" to "G&H:16" and "A&B15" to "A&B:16"

H G F E D C B
A
XXXXXX XXXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX 15
XXXXXX XXXXXX NEW ITEM XXXXX XXXXX 16
NEW ITEM
17

Loop:

IF NEW ITEM i.e. "B:16" = Empty, but "E17"=anything, THEN
copy "G&H:16" to "G&H:17" and "A&B16" to "A&B:17"

UNTIL no more new items

Hope this is clear....thanks
 
D

Don Guillett

Without looking at your file, try this idea

Sub copyifblank()
lr = Cells(Rows.Count, "b").End(xlUp).Row
For i = 2 To lr
If Cells(i, "d") = "" Then
Cells(i, "a").Resize(, 2).Copy Cells(i + 1, "a")
Cells(i, "g").Resize(, 2).Copy Cells(i + 1, "g")
End If
Next i
End Sub
 

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

Top