Dynamic Sheet Queries

TheSliink

New Member
Joined
May 20, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,

Im new to all this so go easy and ill try my best to keep it simple but dont think there is an overly concise way to summarise this. Im trying to produce a workbook which serves as a one stop shop for our orders recieved and dispatching side of the business whilst trying not to change too much aesthetically on the surface so the transition is smooth and embraced as currently there is duplication for this in 4 separate places as well as a POS portal, which as you can imagine is leading to a large amount of human error and poor productivity.

I wish to have two control documents (probably can be one if im honest) which is a list of our customers as a master list, then a list of the product lines which pack size and qty etc per customer depedant on which ones are applicable to them.

I wish to use the latter template as the daily order sheet which means i duplicate it for each day (sheets to be named by date ie. 010624). I then want to be able to pull that sheet through to a 'Load Sheet' where it removes all the lines where there is a qty of 0 so we can see how many orders we have got, how many pallets it equates to etc. Id like to be able to do this through a drop down list (which is auto populated by the sheet names as and when they are added)


Any help on the set up would be greatly appreciated :)

Data is dummy for obvious reasons with blanks which i can fill at a later date.

This is the Master Customer List.

Book2.xlsx
ABCDE
1CustomerSiteProductDel. SiteHaulier
2Customer AFKPU
3Customer BGLQV
4Customer CHMRW
5Customer DINSX
6Customer EJOTY
Customer List MASTER


This is the Master Customer Lines List

Book2.xlsx
ABCDEFGHIJ
1CustomerSiteProductDel. SiteHaulierCountPack WeightBox TypeBoxes/PalletPallets
2Customer AFKPU12
3Customer AFKPU34
4Customer AFKPU56
5Customer AFKPU78
6Customer AFKPU910
7Customer BGLQV1112
8Customer BGLQV1314
9Customer BGLQV1516
10Customer BGLQV1718
11Customer BGLQV1920
12Customer BGLQV2122
13Customer CHLQV2324
14Customer CHLQV2526
15Customer CHMRW2728
16Customer DINSX2930
17Customer EJOTY3132
18Customer EJOTY3334
19Customer EJOTY3536
20Customer EJOTY3738
21
Customer Lines MASTER


This is the Daily Order Sheet with 010624 as the name

Book2.xlsx
ABCDEFGHIJK
1CustomerSiteProductDel. SiteHaulierCountPack WeightQuantityBox TypeBoxes/PalletPallets
2Customer AFKPU121
3Customer AFKPU342
4Customer AFKPU563
5Customer AFKPU784
6Customer AFKPU910
7Customer BGLQV11125
8Customer BGLQV13146
9Customer BGLQV15167
10Customer BGLQV1718
11Customer BGLQV19208
12Customer BGLQV21229
13Customer CHLQV2324
14Customer CHLQV252610
15Customer CHMRW2728
16Customer DINSX293011
17Customer EJOTY313212
18Customer EJOTY3334
19Customer EJOTY353613
20Customer EJOTY3738
010624



As mentioned, i then want to choose a named worksheet from a drop down list on the Load Plan sheet which will filter out lines with 0 qty and then allow me to assign load numbers in a Load Number column to then slice view on the despatch page to assign pallet numbers etc. This is where im pretty fixed in method otherwise too much change, old dogs new tricks etc etc .


Thanks in advance
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I hope this might give you something to start with.

You will need to either adjust the sheet names in the VBA or adjust the sheet names in your workbook with the following VBA, but here is how I would generate a list of those daily order sheets, removing the non-daily-order sheets from consideration. I started most of the sheet names with "Master" just so I could remove those with one if statement, but I also have a "Load Plan" sheet included

VBA Code:
Sub CreateSheetList()
    ' Create a named range on a "Master Sheet List" for dropdown menu
    Dim DatedSheet As Worksheet, EntryRow As Long, LastRow As Long
    Dim SheetListName As Name
    
    With ThisWorkbook.Sheets("Master Sheet List")
        .Range("A:A").Delete
        EntryRow = 1
        For Each DatedSheet In ThisWorkbook.Sheets
            ' Don't add "Master" sheets or "Load Plan" to list
            If Left(DatedSheet.Name, 6) <> "Master" And _
                DatedSheet.Name <> "Load Plan" Then
                ' Include a ' mark in front so the leading 0s are not removed
                .Cells(EntryRow, 1).Value2 = "'" & DatedSheet.Name
                EntryRow = EntryRow + 1
            End If
        Next DatedSheet
        
        LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
        
        If RangeExists("DatedSheetList") Then
            Set SheetListName = ThisWorkbook.Names.Item("DatedSheetList")
            SheetListName.RefersTo = .Range(.Cells(1, 1), .Cells(LastRow, 1))
        Else
            Set SheetListName = ThisWorkbook.Names.Add("DatedSheetList", _
                .Range(.Cells(1, 1), .Cells(LastRow, 1)))
        End If
        
    End With
End Sub

This will create a daily order sheet list on the Master Sheet List, and create a named range ("DatedSheetList") that you can use for a Data Validation Drop-down.

Then on the Load Sheet, I have A1 as "Select Sheet:", and B2 as the drop-down list of daily order sheets.

The following formula is pretty nasty in my eyes, but it seems to be getting the job done. I'm assuming you'll need to adjust the range, and I don't know how you plan to use it or save it, but this should show a table of those that actually have a quantity listed:

Excel Formula:
=TEXTSPLIT(TEXTJOIN("|",TRUE,LET(array,INDIRECT("'" & $B$1 & "'!A1:K20"),join,BYROW(array,LAMBDA(a,IF(CHOOSECOLS(a,8)<>"",TEXTJOIN(";",FALSE,a), ""))),FILTER(join,join<>""))),";","|",FALSE)

That gives me this:

LoadSheet.PNG


The Indirect formula has to refer to the daily order sheet cell that was selected, and the !A1:K20 would have to be adjusted for whatever range you need to pull from the sheet. The thing I'm not sure about is how you might want to enter more data based on that info. You might need more VBA to copy the data over to another sheet for further processing or something like that. I hope this helps get you started.
 
Upvote 0

Forum statistics

Threads
1,224,810
Messages
6,181,079
Members
453,021
Latest member
Justyna P

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