Macro to insert above cell data until next filled cell

henway

Board Regular
Joined
Jul 19, 2006
Messages
85
Our old system outputs text files of invoices showing the Invoice# in Column C and the various part order lines in Column D.
If there is only one part per Invoice the data is fine.
But if there are multiple parts being ordered the Invoice# in column C will appear ONLY in Line 1 and not in any subsequent row until there is a newer Invoice#.
I am trying to make a macro to copy down the Invoice number to all the lines of the same invoice.
The logic of whether to do it is easy: =IF(AND(C3="",D3>D2),"Copy","")
But I have no idea of how to make a macro be smart enough to drag down the invoice number in C to all the cells until the next filled C cell.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,216,039
Messages
6,128,451
Members
449,454
Latest member
khalid7977

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top