Getting data from multiple tabs onto a master tab

jmotola

New Member
Joined
Jul 17, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,
I'm trying to accomplish the following:
Get data from multiple tabs in a specific cell range (B3-E169).
Data would be compiled in columns...i.e., column B copies into column B on new spreadsheet, column C copies into column C on new spreadsheet, etc.
If there are more than two blank columns in B, stop & move onto next worksheet and get same data.
The result that I'm trying to get is a material list from different categories (hence the different tabs).

This is how I think it should work:
Lookup WS1 column B3-B169.
If two blank columns, Lookup WS2 column B3-B169,
If two blank columns, Lookup WS3 column B3-B169, etc.

WS2 should skip a space/column & come in underneath WS1.
WS3 should skip a space/column & come in underneath WS2,.etc.

Repeat for columns C, D & E

I have tried the VBA code available here but I'm not sure how to modify to my application: Merge cells from all or some worksheets into one Master sheet

Tabs I need searched are below:

Tabs.png


Sample data below:

Sample Data.png


As you can see, I leave a space between different items & there should also be a space between data from different tabs.
If there is more than one space between rows, then it should start searching the next tab.
Also, I do have an ActiveX Checkbox that allows me to choose which tabs show & which tabs are hidden.
It can disregard hidden tabs.

Thanks in advance ?
 

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.
Hi and welcome to MrExcel.

Create a sheet with the name "Master". Check if the following helps you

VBA Code:
Sub Getting_data_from_multiple_tabs()
  Dim sh1 As Worksheet, sh2 As Worksheet
  Dim lr1 As Long, lr2 As Long
 
  Set sh1 = Sheets("Master")
  For Each sh2 In Sheets
    If sh2.Visible = xlSheetVisible And sh2.Name <> sh1.Name Then
      lr1 = sh1.Range("B" & Rows.Count).End(3).Row + 1
      lr2 = WorksheetFunction.Max(sh2.Range("B" & Rows.Count).End(3).Row, 3)
      sh1.Range("B" & lr1).Resize(lr2 - 2, 4).Value = sh2.Range("B3:E" & lr2).Value
    End If
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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