PDA

View Full Version : Macro for sorting by lot number, splitting table w/new header, then sort by due date



SteveSmith98
11-19-2019, 07:21 AM
Our database yields us a large Excel table with two important pieces of information: Affected Lot and due date. I need a macro that can first sort by lot number, then split the table into numerous tables, one for each similar lot number, with a new header applied. See below for example:

From this:



Due Date
Deviation Number
Affected Lot


14-Nov-2019
1
A


23-Nov-2019
2
C


01-Dec-2019
3
B


14-Nov-2019
4
A


15-Dec-2019
5
D





To this:




Due Date
Deviation Number
Affected Lot


14-Nov-2019
1
A


14-Nov-2019
4
A







Due Date
Deviation Number
Affected Lot


23-Nov-2019
2
C







Due Date
Deviation Number
Affected Lot


01-Dec-2019
3
B







Due Date
Deviation Number
Affected Lot


15-Dec-2019
5
D



My attempt at word VBA has shown me I don't know enough to know how little I truly know (:banghead:) so any help would be greatly appreciated.

Thank you

snb
11-19-2019, 09:50 AM
A sample workbook likewise.

p45cal
11-19-2019, 10:12 AM
A sample workbook would prevent a lot of incorrect guesswork from us.
In the attached, 2 sheets, one with a table (a proper Excel Table (listobject)) and one without. Buttons calling a variation of the same macro.