auto fill blanks in multiple columns with formula or macro

markman235

New Member
Joined
May 10, 2011
Messages
46
Hi everyone,

I have a sheet with several hundred line items. Columns A - I are only populated at the start of each unique PO.

So if i have a PO with 5 line items, columns A - I would have the PO data in row 1, but 2 - 5 would be blank. Row 6 would be populated with the data from the next PO.

Is there an easy way with either a macro or formula to get these columns to copy data to the blank cells?

Thanks everyone,

Mark
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I can think of two ways to do this. One would be using VBA and the other would use Power Query/Get and Transform. If you can post some sample data showing what your worksheet would look like, I am sure that someone here (me included) can offer up a viable solution that will work for you.
 
Upvote 0
Thanks Allen, I need all the help i can get.

This is the sheet i am working with.

Division
NumberIDNumberDay CodeTimeStatusDateNumberNumberUPCQuantityQuantity
755
17211479911:48D<st1:date ls="trans" month="12" day="2" year="2018">12/2/2018</st1:date> 680213031001111050266228228
3041001111050268350350
6071001111050279114114
29321001111050312140140
29331001111050313114114
29351001111050315456456
29371001111050317200200
571301001111050072114114
755
17211497911:48D<st1:date ls="trans" month="12" day="4" year="2018">12/4/2018</st1:date> 684703031001111050266342342
3041001111050268420420
29321001111050312350350
29331001111050313228228
29351001111050315684684
755
17211498911:48D<st1:date ls="trans" month="12" day="4" year="2018">12/4/2018</st1:date> 6847134410011110503237070
<colgroup><col width="98" style="width: 74pt; mso-width-source: userset; mso-width-alt: 3584;"> <col width="58" style="width: 44pt; mso-width-source: userset; mso-width-alt: 2121;"> <col width="53" style="width: 40pt; mso-width-source: userset; mso-width-alt: 1938;"> <col width="58" style="width: 44pt; mso-width-source: userset; mso-width-alt: 2121;"> <col width="65" style="width: 49pt; mso-width-source: userset; mso-width-alt: 2377;"> <col width="54" style="width: 41pt; mso-width-source: userset; mso-width-alt: 1974;"> <col width="45" style="width: 34pt; mso-width-source: userset; mso-width-alt: 1645;"> <col width="75" style="width: 56pt; mso-width-source: userset; mso-width-alt: 2742;"> <col width="58" style="width: 44pt; mso-width-source: userset; mso-width-alt: 2121;" span="2"> <col width="99" style="width: 74pt; mso-width-source: userset; mso-width-alt: 3620;"> <col width="61" style="width: 46pt; mso-width-source: userset; mso-width-alt: 2230;"> <col width="69" style="width: 52pt; mso-width-source: userset; mso-width-alt: 2523;"> <tbody> </tbody>
 
Upvote 0
If you use Power Query, first convert your range of data to a table and name it Table3. Then.....

Open Power Query/Get and Transform. Click on New Query.

Open blank query in the editor, launch Advanced Editor and paste in the following code.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Division", Int64.Type}, {"Number", Int64.Type}, {"ID", Int64.Type}, {"Number2", Int64.Type}, {"Day Code", Int64.Type}, {"Time", type number}, {"Status", type text}, {"Date", type datetime}, {"Number3", Int64.Type}, {"Number4", Int64.Type}, {"UPC", Int64.Type}, {"Quantity", Int64.Type}, {"Quantity5", Int64.Type}}),
    #"Filled Down" = Table.FillDown(#"Changed Type",{"Division", "Number", "ID", "Number2", "Day Code", "Time", "Status", "Date", "Number3"})
in
    #"Filled Down"
 
Last edited:
Upvote 0
Or with a macro
Code:
Sub MyFillDown()
With Range("A2", Range("J" & Rows.Count).End(xlUp).Offset(, -1))
   .SpecialCells(xlBlanks).FormulaR1C1 = "=r[-1]c"
   .Value = .Value
End With
End Sub
 
Upvote 0
If I understand it each blank cell in your range would equal the cell above. I don't think you need a macro for this although it is quicker I expect.

If you select your data then right click and press CTRL+G
Click on Special and tick 'Blanks' then press OK. All your blank cells in the range are selected.
Then press = then your up arrow
Press CTRL and ENTER.
 
Upvote 0

Forum statistics

Threads
1,215,049
Messages
6,122,864
Members
449,097
Latest member
dbomb1414

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