VBA to extract certain data from multiple sheets to a master sheet

white95gt

New Member
Joined
May 8, 2014
Messages
12
Hello,

I have a workbook with more than 20 sheets, each sheet is the same, its a bill of material for certain part #'s. I would like to extract the BOM from each sheet to a single sheet.

A1 has kit part #
A2 colum qty.
B2 parts

Each sheet has 1 kit part #, and 3 parts to make the kit. Therefore A3 - A5 is quantities of parts, B3- B5 is part numbers.

Is it possible to extract all the kit part #, and BOM from each sheet to one sheet?

I would insert an example however i dont know how.

Thanks,
Jon
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
How about
Code:
Sub GetBomDetails()

   Dim ws As Worksheet
   
   Sheets.Add(Sheets(1)).Name = "Details"
   For Each ws In Worksheets
      If Not ws.Name = "details" Then
         ws.Range("A1").Copy Sheets("Details").Range("A" & Rows.count).End(xlUp).Offset(1)
         ws.Range("A3:B5").Copy Sheets("Details").Range("A" & Rows.count).End(xlUp).Offset(1)
      End If
   Next ws
End Sub
 
Upvote 0
Thank you, works perfectly.

Is it possible to put the kit part # in column a, and the BOM qty' and parts in B and C?


Jon
 
Last edited:
Upvote 0
Try
Code:
Sub GetBomDetails()

   Dim ws As Worksheet
   
   Sheets.Add(Sheets(1)).Name = "Details"
   For Each ws In Worksheets
      If Not ws.Name = "details" Then
         ws.Range("A1").Copy Sheets("Details").Range("B" & Rows.count).End(xlUp).Offset(1, -1)
         ws.Range("A3:B5").Copy Sheets("Details").Range("B" & Rows.count).End(xlUp).Offset(1)
      End If
   Next ws
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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