Return a bill of material that's created on another sheet without any lines that = 0

Ecustis

New Member
Joined
Mar 10, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all,

This has been driving me crazy. Basically, I'm trying to build a bill of material on a sheet that's separated by vendor and then display every line item that has a quantity value of >=1 on another sheet.

For example, this would be my bill of material list on a separate sheet:
QtyTypeDescriptionPriceTotal
1PanelGeneric Description$100=D2*A2
0WireGeneric Description$200=D3*A3
5PanelGeneric Description$200=D4*A4
2PanelGeneric Description$500=D5*A5

Then, I would want this main sheet to display every line item that is >=1, so row 3 wouldn't be displayed on this sheet.
My main sheet would then look like this

QtyTypeDescriptionPriceTotal
1PanelGeneric Description$100$100
5PanelGeneric Description$200$1000
2PanelGeneric Description$500$1000

Is this even possible? I feel like anything can be done with excel, but it's driving me crazy not being able to figure it out. I've searched every possible term I could think of on google to try and see who's already accomplished this before, but no luck.

Any help is greatly appreciated. Thanks!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hello Ecurtis,

This should do what you want. Simply it, unhides all the rows and clears the data, then copies the data from Sheet9 and pastes it into A1; then hides the rows with a 0 value.
You need to Change:- Sheets("Sheet9").Range("A1:E4").Copy to your sheet name and range, Range("A1:E4").ClearContents to a similar range.
Then you apply the macro to a shape, when the data changes; just run it again.

VBA Code:
Sub Material()
Dim i As Integer
i = 1
    Cells.EntireRow.Hidden = False 'unhides all the rows
    Range("A1:E4").ClearContents 'clears current data
  
    Sheets("Sheet9").Range("A1:E4").Copy 'copies data from other sheet
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False 'pastes values to this sheet

    For i = 1 To 20
    If Cells(i, 1).Value <= 0 Then
    Cells(i, 1).EntireRow.Hidden = True 'hides all the rows with a 0 in column A
    End If
Next i
End Sub

NB Set the shape properties to do non move or resize with cells - the shape may get hidden. :)

Jamie
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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