Hi !
See attached workbook: I wrote a macro to sort a table, but my code isn't robust enough to work in every situation.
I want my table filtered by batch number (A to Z) and within those batch numbers, I want the product order "EM", "AA", "G" to be respected. However: sometimes we have several "EM", "AA" and "G" products per batch. In those cases, I want to respect the product order using the comment column. This works when all 3 comments are identical (see batch 17A25N13 with the comments that start with "A 02"), but doesn't work when they're not (see the other lines for 17A25N13, or batch 17A25N14)
I should specify that, everytime there is more than 3 lines of the same batch, there is always a comment that will help sort the thing.
Any idea how to have the code work every time ? Thanks !
See attached workbook: I wrote a macro to sort a table, but my code isn't robust enough to work in every situation.
I want my table filtered by batch number (A to Z) and within those batch numbers, I want the product order "EM", "AA", "G" to be respected. However: sometimes we have several "EM", "AA" and "G" products per batch. In those cases, I want to respect the product order using the comment column. This works when all 3 comments are identical (see batch 17A25N13 with the comments that start with "A 02"), but doesn't work when they're not (see the other lines for 17A25N13, or batch 17A25N14)
I should specify that, everytime there is more than 3 lines of the same batch, there is always a comment that will help sort the thing.
Any idea how to have the code work every time ? Thanks !
Attachments
Last edited: