VBA Macro for creating multiple sheets on command

Suavesav

New Member
Joined
Mar 14, 2023
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
The VBA code should identify the customer name selected in the dropdown and copy it's headers into a new sheet. It then has to look for this customers data under the headers and add it to the sheet. It is not working as consistently as intended. Some sheets are only created with the Headers.


Source -
Test DSR OFS Macro All Ocean Customers.xlsm
ABCDEFGHIJKLM
1Customer Name Test1
2
3
4STATIONHOUSEBILLFILEIDJOBTYPESHPRNOSHPRNO1CSEENOCSEENADR1CSORNOCSORNADR1POINVBU
5AMDINOT53-000015OT000
6AMDAMD230382816INOA53-005842OA1000671848ABC1000673692GHI1000671848GHI
7AMDAMD230382816INOA53-005842OA1000671848XYZ1000673692VIE1000671848VIE
Source
Cells with Data Validation
CellAllowCriteria
B1List=Reference!$B$1:$CF$1


Reference -
Test DSR OFS Macro All Ocean Customers.xlsm
ABCDEFGHIJKLMNOPQ
1Customer NameTest1TestBoschBharat ForgeAPOLLO TYRES LTDPerkins India TLMPerkins India FGW GC CTL XQPPerkins India LB BB IRLAMMOTHERSONHERTZJAPNA INC.,ASHTECHTHYSSENRUPPNATHSPM AUTOGEFCO
2Header 1STATIONSHPRNO1SHPRNO1Sr.NoBKG released dt, SI filled dt, VSL ETD dtShipment MonthMonthSl.No CONTAINER NOSr NoSr NoSr NoSr NoSr NoShipper Sr. No.
3Header 2HOUSEBILLPOETDBfl invoice no.LocationECI No.TypeMonthInvoice NOSHPRNO1SHPRNO1SHPRNO1SHPRNO1SHPRNO1PODATE
4Header 3FILEIDFREIGHT_RCVFREIGHT_RCVShipperHandlerCustomer NameSTATEConsignee NameInvoice DateCneeCneeCneeCneeCneeRcvdCurrent Remarks
5Header 4JOBTYPEPickupHOUSEBILLHBL No.NRA dtPickup locationCustomer NamePickup locationShipping lineBookingBookingBookingBookingBookingPickupShipper
6Header 5SHPRNOColoader Coloader CustomerNRA numberPort of LoadingPickup locationPort of LoadingSailing DateMBLMBLMBLMBLMBLColoader Consignee
7Header 6SHPRNO1POLPOLSectorJOB #POD NamePort of LoadingPort of DischargeETA JobConsole noJobJobJobPOLJob #
8Header 7CSEENOPODPODPODMBL #Country of EntryPOD NameCountry of DestinationDELIVERY DATEHBLJobHBLHBLHBLPODBL #
9Header 8CSEENADR1Inv Vessel Final DestinatooonHBL #ContinentsCountry of EntryFreight TermShipper InvHBLShipper InvShipper InvShipper InvInv Terms
10Header 9CSORNOJobETDDispatch dt from BFLETDContainer typeContinentsDelivery termsPOL Shipper InvPOL POL POL JobContract no.
11Header 10CSORNADR1SBATDStuffing locationETANo Of TuesContainer typeShipment ModePODPOL PODPODPODSBCo-loader/Carrier boking no.
Reference




Intended result
Test DSR OFS Macro All Ocean Customers.xlsm
ABCDEFGHIJ
1STATIONHOUSEBILLFILEIDJOBTYPESHPRNOSHPRNO1CSEENOCSEENADR1CSORNOCSORNADR1
2BOMSOF02394637INOD51-061123OD1000044673CEVA1000392439DURAVIT INDIA PVT LTD1000392439DURAVIT INDIA PVT LTD
20230710_140326
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I do not see a BOM in the data, only in the result. Do you specify which customer in B1 of source? What is the reference data used for?
 
Upvote 0
I tried to understand the objective but I cannot. Please try again to describe the way that the results are generated.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

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