+ Reply to Thread
Results 1 to 105 of 105

split Tables into multiple Tables for multiple sheets with different structure & arranging

  1. #1
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    split Tables into multiple Tables for multiple sheets with different structure & arranging

    Hi experts
    I have data are not arranged when I use PQ it will make big chaos . so I think VBA could arrange this but with help from the experts .
    so I want split the TABLE in TT sheet into multiple tables for multiple sheets based on column A and rename the sheet based on column A for each TABLE .
    so TABLE1 =BS Q 4286.pdf start from row2:30 when split will rename the sheet to become is BS Q 4286.pdf when split TABLE should merge columns F,G with column E as in row2,row 25 will see that how merged as in BS Q 4286.pdf. and arrange the columns based on headers should be
    column A for BS Q 4286.pdf sheet=column H for TT sheet= ITEM
    column B for BS Q 4286.pdf sheet=column E for TT sheet=BRAND
    column C BS Q 4286.pdf sheet= column C for TT sheet=ORIGIN
    column D BS Q 4286.pdf sheet=column B for TT sheet=QTY
    ignore data in columns A,D, also F,G after merging (should merge items for column (G,F with column E)

    after split for BS Q 4286.pdf in column B should add to last item by short letters as in adjacent cell for ORIGIN column C which contain words based on matching between two columns in LISS sheet for each adjacent cell
    for instance :
    if the last item into cell IND for column B and the adjacent cell Indonesia for column C for BS Q 4286.pdf then the last item into cell for column B will become INDO based on matching between two columns in LISS sheet for each adjacent cell
    and if the last item into cell doesn't contain short letters then will add based on adjacent cell for ORIGIN column C like JAPAN to become in last item JAP for column B and if the last Item contains short letters like JAP or THI .... in column B then don't add any thing in last item
    as to name PR-2023-00001.pdf start from row31:43 when split will rename the sheet to become is PR-2023-00001 and arrange the columns based on headers should be
    column A for PR-2023-00001 sheet=column B for TT sheet= Sr
    column B for PR-2023-00001sheet=column D for TT sheet=DESCRIPTION
    column C for PR-2023-00001= column F for TT sheet=QTY
    ignore column A, D, E,G,H
    ignore data in columns D,E
    column F=QTY , but should delete UNIT word
    as to addition to last item by short letters should just add JAP without see LSS sheet because there is no ORIGIN column

    as to name STOCK B.S TO 31-10-2022.pdf start from row44:69 when split will rename the sheet to become is STOCK B.S TO 31-10-2022.pdf
    the column A for STOCK B.S TO 31-10-2022.pdf=column E for TT sheet =Sr
    the column B for STOCK B.S TO 31-10-2022.pdf=column D for TT sheet =Description
    the column C for STOCK B.S TO 31-10-2022.pdf=column B for TT sheet =ORIGIN
    the column D for STOCK B.S TO 31-10-2022.pdf=column C for TT sheet =QTY
    ignore data in columns A,F,G,H
    as t0 add short letters follow the same thing as in
    BS Q 4286.pdf sheet
    should split into multiple sheets & update the sheets have already divided when update TT sheet ,also will add new ranges for tt sheet with the same structure as in attachment .
    Attached Files Attached Files
    Last edited by abdo meghari; 03-04-2023 at 12:41 PM.

  2. #2
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    should split from the header until lastrow before new header for new range .

  3. #3
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    is there any help?

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Please Login or Register  to view this content.
    I added POLAND/POL to "LISS" table
    Attached Files Attached Files
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    thanks
    I note some items are missed for row2 & row25 for sheet BS Q 4286.pdf
    will give BS 1200 R20 18PR THI , the right is BS 1200 R20 18PR G580 THI
    BS 265/70R18 JAP , the right is BS 265/70R18 D684 JAP

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Hi,

    how is the workbook before state : all the 3 data pdf worksheets already exist ?

  7. #7
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    all the 3 data pdf worksheets already exist ?
    absolutely yes .

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    So no need to « rename the sheet as you wrote » or … ?

  9. #9
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    So no need to « rename the sheet as you wrote » or … ?
    why you suggest this?
    my aim for that check data what is in inside for each sheet and compare with the original data for each PDF file .
    at least make easy to select specific sheet based on matching with PDF file name

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    As I do not suggest anything but just reading your initial post 'explanation' !

    As my aim it to make understand the threads creators that a before workbook & an expected result attachment
    could 'highlight' an explanation in order to have more chance to receive some help quicker …

    According to your last post it seems the original subject has changed ! No compare mention in your original 'explanation' …
    So confusing …
    Last edited by Marc L; 02-26-2023 at 04:24 AM. Reason: typo ...

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Where is your desceiption do you mention concatenating "BRAND" and "column5/Column6" ? Why has this separation occurred ??

    Given the the history of your posts - all of which involve manipulating data in multiple formats - , you have a real problem with your data collection/organisation. I would go back to basics and solve these basic problems.

    In the current case (as per Marc L) you have joined 3 unconnected files into one simply to separate them !!!
    Last edited by JohnTopley; 02-26-2023 at 05:31 AM.

  12. #12
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Yes with Excel basics the code should be shorter, less than 70 codelines …

  13. #13
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    As my aim it to make understand the threads creators that a before workbook & an expected result attachment
    ok . but I put the result for three sheets how should split based on tt sheet and support so with details as in OP .
    could 'highlight' an explanation in order to have more chance to receive some help quicker …
    but I don't understand what you mean ?
    which explanation need highlight ?
    I'm afraid you mean my thread is not clear totally .
    I know this data are chaos , but this is not from me . this happens after export PDF file as in excel, that's why I posted thread to arrange this data by vba

    According to your last post it seems the original subject has changed ! No compare mention in your original 'explanation' …
    no no ! I don't changed original subject . just I gave you my reason why rename sheets as in column A ,Naturally will be the same PDF files names .
    my requirements stay as what I posted in initial post .

  14. #14
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Where is your description do you mention concatenating "BRAND" and "column5/Column6" ?
    I said this
    also F,G after merging
    and I edited by add this (should merge items for column (G,F with column E)
    should ignore specific columns F, G after merging an I did it as in result for row2,25

    Why has this seperation occurred ??
    this happens after export PDF files as EXCEL files
    Given the the history of your posts - all of which involve manipulating data in multiple formats - , you have a real problem with your data collection/organisation. I would go back to basics and solve these basic problems.
    that's correct . but this time happens without interfere from me . this happens after convert PDF files to EXCEL files.
    Last edited by abdo meghari; 02-26-2023 at 05:17 AM.

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Please Login or Register  to view this content.
    Merges Cells and then clears

    I am sure Marc L will have some "smarter" code!
    Attached Files Attached Files
    Last edited by JohnTopley; 03-06-2023 at 07:20 AM.

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Following up on your replies: do you always receive your data as PDF files? If so, it would (must!) be worth considering writing an an "Excel-to-PDF" conversion/cleanup macro producing a single file format AND common field (column) headings.

    Foe example "Item code"="Brand", "Description" ="Brand", "Accepted Quantity"="Qty", "Production"="Origin" ....etc

  17. #17
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    thanks
    Following up on your replies: do you always receive your data as PDF files? If so
    yes
    it would (must!) be worth considering writing an an "Excel-to-PDF" conversion/cleanup macro producing a single file format AND common field (column) headings.
    yes I agree with you , and I already know that . in this time I have to split and arranging for each separated sheet firstly and I will create another sheet with single field (column) headings and merging whole sheets by another macro has already existed .
    I have some notices:
    1- the macro doesn't create sheets automatically . I have to create manually , this is not problem
    2- and will change data from TABLE to range . also this is not problem I will change to table after run the macro
    3 in this point I want fixing as I said
    should update the sheets have already divided when update TT sheet
    it means any change in tt sheet should automatically change in others sheet are divided.

  18. #18
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Is the tt sheet changes everyday ? So another way is to create an event for each of the 3 already created worksheets
    - but hoping there are only 3 sheets and that will never change ? -
    like for example each time when activating a sheet, even without any new data
    but according to your small data attached workbook the result should be instant …

    But o b v i o u s l y rather than such gas factory VBA procedure as the import is not correct - no sense to mix data like that ! -
    the appropriate way is to import only one file directly to its relative worksheet !

    You wrote « the macro doesn't create sheets automatically » but you yet answered « absolutely yes » for the before state
    so meaning no need to create it ‼

    You wrote « will change data from TABLE to range » but o b v i o u s l y your attachment expected result contains
    a sheet with no table, your bad !
    You must be a lot more accurate when creating such thread and its attachment.
    So yes when nobody answers that means your initial post is not clear enough …

  19. #19
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Quote Originally Posted by JohnTopley View Post
    I am sure Marc L will have some "smarter" code!
    Maybe, maybe not, but as from post to post his explanations are contradictory
    and as just importing correctly the data so such after bad import VBA procedure is totally useless so why wasting time ? …

    According for what I thought yesterday to have decypher his need - but very not sure today after his new posts ! -
    just using Excel basics in a VBA procedure just replicating what an Excel beginner can operate manually
    I was 'seeing' a shorter code with around 60 codelines …

  20. #20
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Is the tt sheet changes everyday ?
    every month
    - but hoping there are only 3 sheets and that will never change ?
    no there is more but I gave you 3 worksheet as in example and could be change but this case is really rare.
    usually the PDF files contains two pages or more with different structure when convert to excel .
    but according to your small data attached workbook the result should be instant …
    yes that's correct , but as I said this case could be rarely, but this case is not problem then I have to import data again from PDF files .

    But o b v i o u s l y rather than such gas factory VBA procedure as the import is not correct - no sense to mix data like that ! -
    as in title of thread with different structure . if it's not different structure I didn't post this question here and this happens when convert to excel data to become like this way.
    the appropriate way is to import only one file directly to its relative worksheet
    I agree with you , but this means arraigning manually one file by one for many files and it takes more time to arrange each sheet.
    You wrote « the macro doesn't create sheets automatically » but you yet answered « absolutely yes » for the before state
    so meaning no need to create it ‼
    misunderstood I thought you're talking about the PDF files , not sheets ,sorry !and this isn't big problem I will create manually.
    You wrote « will change data from TABLE to range » but o b v i o u s l y your attachment expected result contains
    a sheet with no table, your bad !
    no way ! attachment is TABLE and when I said will change data from TABLE to range to John because of b v i o u s l y can't deal with TABLES and I don't make hard the matter for him but based on attachment should be as TABLE.
    Last edited by abdo meghari; 02-26-2023 at 04:04 PM.

  21. #21
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    According to your attachment 2 destinations sheets use a table but the third does not contain any table ‼

    So you forgot to indicate there are more than 3 sheets ‼
    Should be not a problem when there is only a single structure but here it's not the case : 3 results sheets, 3 different layouts ‼
    So according to your initial 'explaination' we can only hardcode these 3 sheets but can do nothing for the others
    without at least a crystal clear elaboration.

    Anyway with more than 500 posts within this forum so you already have the material like some time to learn and
    with the help you already received from John you can fit his code for the other destination sheets when necessary …
    Last edited by Marc L; 02-26-2023 at 07:52 PM.

  22. #22
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    According to your attachment 2 destinations sheets use a table but the third does not contain any table ‼
    this is not big problem(minor). as I mentioned TABLE whether in title of thread or in OP become this error useless if you like mentioned that to warn me will I take it as consideration or correct but this is not obstacle to others members try to help me . I see in this forum there is more big mistake than this and the members inform owner's thread to this mistake.
    So you forgot to indicate there are more than 3 sheets ‼
    forgot !!!
    why I have to mentioned that if I have the same structure as in different structure for three ranges !
    So according to your initial 'explanation' we can only hardcode these 3 sheets but can do nothing for the others
    without at least a crystal clear elaboration.
    multiple ranges as in attachment without any else different I don't mentioned doesn't make difference
    with the help you already received from John you can fit his code for the other destination sheets when necessary …
    without any doubt , but the code will be huge by adding more lines when add new sheets .
    thanks for your time.

  23. #23
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    The code can be not such huge if you find at least a strategy (logic) to detect if a destination sheet matches one of the three structures
    if only there are only three (if it's the case so why such poor initial attachment ?!) …
    But for more data structures yes you will have to add more codelines.

  24. #24
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    @abdo: To try and resolve this, we need to know ALL possible formats of the PDF files you receive and for you to agree the final output format with (for example) consistent headings.

    Once we have this information, we will be in a better position to try and optimise any code (in, as I said earlier, a single PDF_to_Excel macro).

    Most of your previous posts have highlighted inconsistent formats which is (surely) not a very effective nor efficient way to process your data.

    Help us to help you.

  25. #25
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    I agree with previous John's post as it can't be professional (lack of brain),
    just good enough for some student training using the Macro Recorder & Excel basics …

  26. #26
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Exclamation Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    I forgot an important point :

    Quote Originally Posted by abdo meghari View Post
    it means any change in tt sheet should automatically change in others sheet are divided.
    No !

    Only with smart workbook with smart worksheets with smart data with an unique smart layout
    with smart project conceptor with smart Excel users …

    When nothing is smart like here so in case of any change you will have to click on a button
    in order to launch the VBA procedure deleting first all sheets after 'tt' sheet
    (according to bad inconsistent attachment design)
    then split the 'tt' data according to its column A in new sheets created after 'tt' sheet …

    If you do not want to operate the button each time so confirm it in order I definitively quit this thread !

  27. #27
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    if only there are only three (if it's the case so why such poor initial attachment ?!) …
    I no know why you said poor!
    do you mean size of rows are little ?
    Only with smart workbook with smart worksheets with smart data with an unique smart layout
    with smart project conceptor with smart Excel users
    so you want to say with this data can't success at all ?!
    you will have to click on a button
    this is not problem, why not?

    If you do not want to operate the button each time so confirm it in order I definitively quit this thread !
    ok I accept clicking button each time .
    I agree with previous John's post as it can't be professional (lack of brain),
    so what's missed to want to know ?
    I said that bad data like this way happens while import data from file PDF
    I gave tt sheet should split based on column A contains files names , each file name contains different data should be arranging as I did it with some details how arrange and add missed items and delete some columns .
    if you say this data are not acceptable , then I will consider your answering can't arrange this data.
    I still don't know what exactly you want to post it

  28. #28
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    we need to know ALL possible formats of the PDF files you receive and for you to agree the final output format with (for example) consistent headings.
    first thank you for your code .
    based on attachment these are only format , not more , just I will add another ranges with the same format as I did it in attachment .
    there is no different format with comparison the attachment . so all of data what ever how many sheets will be as in three ranges in attachments when add many ranges .
    Most of your previous posts have highlighted inconsistent formats which is (surely) not a very effective nor efficient way to process your data.
    yes that's correct and you have ever said me , but in this case the circumstances is entirely different.

  29. #29
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    On our side the circumstances are the same than before …

    Anyway, as in case I post an Excel basics VBA procedure according to your initial attachment it will be an one shot starter,
    I will not modify it for what your forgot / misexplained, to be sure to not waste any time,
    in 'tt' sheet column A you can have for example 20 files but only with three possible data structures
    and only three expected layouts results like in your initial attachment ?

    According to post #23 did you think at least about a strategy ?


    To John : did you start something ? So in this case I let you ending your code …
    Last edited by Marc L; 02-27-2023 at 06:46 PM.

  30. #30
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    @Marc: only the macro I posted.

  31. #31
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Erratum ...


    Quote Originally Posted by abdo meghari View Post
    it means any change in tt sheet should automatically change in others sheet are divided.
    Quote Originally Posted by Marc L View Post
    No !
    My bad !
    In fact possible just reproducing the same way than splitting all names but just for the one where the change occurs.
    Blind I was 'cause of all the bad things within the initial attachment …

    So just creating a stand alone VBA procedure for each data structure / expected result layout
    in order to use it whatever when splitting all names or when a change is made in 'tt' worksheet, the modular way !
    So the code - two times heavier than what I thought according to the initial post - should contain three data layout procedures,
    a procedure splitting all names and the Change worksheet event procedure …

    But as often under Excel different ways are possible to reach the goal, even just using Excel basics.
    According to the initial attachment, any should be good enough.
    But with a workbook with much more data, I can't guess which way to go, which should be the slower or the faster …

    How many rows / source names in your real workbook ?

  32. #32
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    On our side the circumstances are the same than before …
    before yes from me, but now no !
    Anyway, as in case I post an Excel basics VBA procedure according to your initial attachment it will be an one shot starter,
    I will not modify it for what your forgot / misexplained, to be sure to not waste any time,
    yes based on attachment , I don't need add more requirements to waste your time
    in 'tt' sheet column A you can have for example 20 files but only with three possible data structures
    and only three expected layouts results like in your initial attachment ?
    yes but it will increase sheets addition based on files are existed in column A .
    According to post #23 did you think at least about a strategy ?
    the only strategy I see should arrange the files when they are EXCEL files before save files as PDF but this is not available because it will received by another company when purchase from of it , I can't enforce company to do that . so alternative strategy should arrange every file for each sheet alone.
    To John : did you start something ? So in this case I let you ending your code …
    I'm not sure what you mean for that .
    In fact possible just reproducing the same way than splitting all names
    you mean in the same tt sheet?
    I think if you did it maybe the code will crash because of the new ranges addition comparison with ranges have already arranged when clicked macro earlier .

    So just creating a stand alone VBA procedure for each data structure / expected result layout
    in order to use it whatever when splitting all names or when a change is made in 'tt' worksheet, the modular way !
    So the code - two times heavier than what I thought according to the initial post - should contain three data layout procedures,
    a procedure splitting all names and the Change worksheet event procedure …
    I hope you understanding the rest of details about add the last items based on first sheet with tt sheet and concatenate items from two columns to column and ignore some columns as John did it in post#15.
    But with a workbook with much more data, I can't guess which way to go, which should be the slower or the faster …
    this is not big and it will differentiate from month to another when send me the files.
    How many rows / source names in your real workbook ?
    The maximum will be 2000 rows

  33. #33
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Quote Originally Posted by abdo meghari View Post
    the only strategy I see should arrange the files when they are EXCEL files
    So you misread post #23 !
    According to 'tt' worksheet, what is the strategy to detect the data structure / the expected result worksheet layout ?

    I already have one based only on your too small initial post attachment but no idea if could well work on the real data.
    As I don't know which way to go, even using only Excel basics the code may have 150 codelines,
    a way using more Excel formulas than the other, so in case you have to fit the code yourself
    you may need all the summer and maybe the winter to well understand it ‼

    And as my evaluating tool says a not go or waste my time, often it's right but maybe it's wrong 'cause of few data,
    I already see a trap but I suspect another one - guessing time but as guessing can't be coding ! - so
    maybe the reason of his negative return …


    Quote Originally Posted by abdo meghari View Post
    you mean in the same tt sheet?
    I mean after the 'tt' data split and arrange VBA procedure if you manually modify a cell within this 'tt' worksheet
    the relative split worksheet can be automatically updated - I was wrong yesterday - without launching
    again the split and arrange procedure …


    Quote Originally Posted by abdo meghari View Post
    I hope you understanding the rest of details
    As we are hoping you have enough well explained …


    Quote Originally Posted by abdo meghari View Post
    The maximum will be 2000 rows
    So why not attach such workbook in particular if you are not able to elaborate the strategy ?
    Save the workbook as binary format .xlsb in order to reduce its size, just in the state after such bad data importation …
    Then I could better see the traps.
    As a reminder, the more data attachment, the more chance you won't have to fit the 150 codelines - maybe more ! - yourself …

  34. #34
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    According to 'tt' worksheet, what is the strategy to detect the data structure / the expected result worksheet layout ?
    I'm not sure what you mean?
    if you want standard , then you can depend on repeated item(file name) from the first row until to last row for the same item and before header row foe new item(new file name).
    As I don't know which way to go, even using only Excel basics the code may have 150 codelines,
    it's like john's code.

    if you write code based on three ranges as in initial post naturally should not be problem when add new ranges as the structure in file
    so I don't need
    so in case you have to fit the code yourself
    you may need all the summer and maybe the winter to well understand it ‼
    bad expression!
    it's not necessary to comment like this way

    I already see a trap but I suspect another one - guessing time but as guessing can't be coding ! - so
    what's trap you're talking about ?
    So why not attach such workbook in particular if you are not able to elaborate the strategy ?
    first sensitive data
    second to make easy the members see a little data instead of follow the whole data , could be bored.
    Save the workbook as binary format .xlsb in order to reduce its size, just in the state after such bad data importation …
    Then I could better see the traps.
    I bet there is no traps , if insist for attaching file with more data I will see what I can do tomorrow.

  35. #35
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Not like John 'cause if I follow the same harcoded way for only 3 result sheets
    - I have understood the same with your initial post - I need very less than 100 codelines …

    As since several posts we are stating about a code without any hardcoded sheet name
    which should also detect each structure so as you are not able to elaborate the necessary strategy,
    as I can't waste time for a code which may work only with your attachment but should fail with your real workbook
    as there are already some traps according to the initial attachment so obviously yes
    just make a copy not sensitive with respecting the original format and with the mandatory sheet 'liss' as well.
    Last edited by Marc L; 02-28-2023 at 04:29 PM.

  36. #36
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    see this file if you help you .
    Attached Files Attached Files
    Last edited by abdo meghari; 03-06-2023 at 08:42 AM.

  37. #37
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow CRASH time so questions time !


    As it can only help you to receive some help …

    According to your initial post attachment I have made 2 days ago
    a little short code to simulate the worksheets creation while detecting the data structure
    but with your last attachment what a crash !
    And it has time to detect 'non matching' structures 'cause of a trap I suspected.

    So I confirm again nothing has changed on our side,
    like in your previous threads with such poor initial post under the level of what any Excel forum expects for
    what could you ever expect ?‼
    Just a code working only with your initial attachment but never with your real workbook !

    The crash arises with a name from 'tt' column A which has more than 31 characters, the limit of a worksheet name
    so what is your strategy according to this issue ?
    For the moment I just reject such file name so its data can not be extracted to its specific worksheet …

    According to your last attachment I have some doubts :
    first do you really receive the 'tt' data like an Excel table or is it you who created this Excel table ? (trap, issues …)
    Why cell A1 has not the same data than cell A2 which does not respect the same data structure than the other filenames ?!

    For the moment I stop here the questions - so many I have before starting to write any codeline ! - but
    according to the initial post like according to the last attachment with 'errors' or missing data - my tool still says no - so
    you will have to modify my code - good lurk, good luck ! Summer, winter … - or you will have to correct the 'tt' data whatever …
    Last edited by Marc L; 03-01-2023 at 08:55 AM.

  38. #38
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    The crash arises with a name from 'tt' column A which has more than 31 characters, the limit of a worksheet name
    so what is your strategy according to this issue ?
    For the moment I just reject such file name so its data can not be extracted to its specific worksheet …
    ok I will rename the sheets as in example (file1,file2.....), not as in original file name
    According to your last attachment I have some doubts :
    first do you really receive the 'tt' data like an Excel table or is it you who created this Excel table ? (trap, issues …)
    Why cell A1 has not the same data than cell A2 which does not respect the same data structure than the other filenames ?!
    sorry I don't note it , should be BS Q 4286.pdf,not Source.Name

    For the moment I stop here the questions but according to the initial post like according to the last attachment
    with 'errors' or missing data so you will have to modify my code - if only I succeed to decypher your need ! - or
    you will have to correct the 'tt' data …
    Well, I will be careful to correct anything that I have explained that does not match what is inside the file, but the code must work according to the data structure standards in addition to the details that have been included with regard to adding origin abbreviations or merging the elements that were divided when entering the data for the related element in the adjacent cell to the adjacent column
    Last edited by abdo meghari; 03-01-2023 at 08:52 AM.

  39. #39
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    As you did not answer for the Excel table so well read again my previous post in order I get at least the expected answer !
    If you modify the original 'tt' data with creating the Excel table so do not, no sense wich such mixed data.
    As your last attachment is just good enough to be trashed so hoping the next one will better reflect at least your real workbook
    without this time such data errors …

    Imagine it's like the NASA, all lights are red so the StarShip can not be launch or rather than discover Mars it will be directly lost in the Sun !
    So any question as a red light, I will try to code only when all lights green …
    Last edited by Marc L; 03-01-2023 at 09:10 AM.

  40. #40
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    As you did not answer for the Excel table so well read again my previous post in order I get at least the expected answer !
    If you modify the original 'tt' data with creating the Excel table so do not, no sense wich such mixed data.
    As your last attachment is just good enough to be trashed so hoping the next one will better reflect at least your real workbook
    without this time such data errors …
    if you mean the code doesn't deal any changes for tt sheet after run your code . ok ignore it , just I will import data from the files , then your code will arrange them and no need changes for tt sheet after the macro arrange all of data

  41. #41
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    No you misread again as I do not mean anything but what I exactly wrote !

    Eight Ball Deluxe, same player shoot again ! Last try :

    Quote Originally Posted by Marc L View Post
    first do you really receive the 'tt' data like an Excel table or is it you who created this Excel table ?
    Quote Originally Posted by Marc L View Post
    If you modify the original 'tt' data with creating the Excel table so do not
    So how really is the raw 'tt' data worksheet when you receive it ?

  42. #42
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    first do you really receive the 'tt' data like an Excel table or is it you who created this Excel table ?
    ok creates table automatically when convert PDF to EXCEL without interfering from me .
    So how really is the raw 'tt' data worksheet when you receive it ?
    there is no raw tt' data worksheet when you receive it . in reality this sheet created automatically when covert PDF to excel and create Table automatically , but I do only renaming sheet manually .

  43. #43
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Modification of my earlier code: uses sheet "ttt" as input, sorted by PDF names

    Like Marc, I found a number of "bugs": long sheet name But I think this is a typo), duplicate PDF nanes, "N/A" entries.

    For consistancy I change A1 to be PDF name as per all other entries.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JohnTopley; 03-01-2023 at 03:57 PM.

  44. #44
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    I would use another workaround according to Dumb or Dumber who creates the table with the first data row as the header table,
    another no sense, again a guy which does not know how Excel rules ! So a red light becomes orange but not green …
    Trying to code something without the need to change anything in the workbook, like the header or like adding Poland in 'liss' worksheet …

    Many other red lights, so questions to follow but I wait first for your revert according to John's code.

  45. #45
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Like Marc, I found a number of "bugs": long sheet name But I think this is a typo), duplicate PDF nanes, "N/A" entries.
    sorry john about it . in reality this is really existed in PDF file this is not typo, but don't care of that I will delete it manually.
    seem your code works very well, but why you use range instead of dynamic lastrow ?
    then I have to rename range for ttt sheet every time when I add new ranges for new files in ttt sheet
    and the tt sheet is not important so I can delete it , is that right?

  46. #46
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    another no sense, again a guy which does not know how Excel rules ! So a red light becomes orange but not green …
    Trying to code something without the need to change anything in the workbook, like the header or like adding Poland in 'liss' worksheet …
    I'm not sure what you try to say ,sorry !

  47. #47
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Re RANGE: I initially had to redefine the "tt" TABLE (and I am not very knowledgeable re structured tables!) And then I simple created range-based data in "ttt": if you require "ttt" to be a structured table then I will have to learrn new VBA code as my knowledge of structured tables really is very limited.!

    For a range-based sheet the range could be made dynamic.

    So perhaps Marc can point me in the right direction with regard to TABLE vs RANGE: or equally he may already have such code already.

    Re "tt" sheet: you can delete it BUT remember the "ttt" sheet is sorted manually by PDF file name (column A)
    Last edited by JohnTopley; 03-02-2023 at 08:07 AM.

  48. #48
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Quote Originally Posted by JohnTopley View Post
    So perhaps Marc can point me in the right direction with regard to TABLE vs RANGE: or equally he may already have such code already.
    Quote Originally Posted by Marc L View Post
    Trying to code something without the need to change anything in the workbook, like the header or like adding Poland in 'liss' worksheet …
    Yes it can be achieved according to the attachment as it is
    so without modifying the 'tt' worksheet neither creating such 'ttt' helper worksheet
    neither adding POLAND for example to 'liss' worksheet according to the initial post attachment …
    As a table can be read like a range - in fact a table is just a specific range - so it's very not a question of table versus range.

    To go further I just need all lights green but as abdo seems to have difficulties to just well read and answer to questions …

    abdo : do you stay with John's code or should I ask red lights questions ?

  49. #49
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Quote Originally Posted by abdo meghari View Post
    but why you use range instead of dynamic lastrow ?
    According to your both static attachments just using Excel basics 'dynamic lastrow' is useless !
    As 'dynamic' has not much sense, last row is enough …

  50. #50
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    My attempt defining "ttt" as table.

    Please Login or Register  to view this content.
    I'll leave it at this! but I have learned something new from this exercise.
    Attached Files Attached Files

  51. #51
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    To go further I just need all lights green but as abdo seems to have difficulties to just well read and answer to questions …
    my English language is bad that's why I find difficulties to understand your expression sorry!
    abdo : do you stay with John's code or should I ask red lights questions ?
    it's up to you, which red lights question?
    if you still interest tell me all of red lights.
    According to your both static attachments just using Excel basics 'dynamic lastrow' is useless !
    did you see john's files contain specific range . so when add new ranges it need create range again by delete the previous so how is useless?

  52. #52
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    My attempt defining "ttt" as table.
    I will see tomorrow . thanks for your efforts.

  53. #53
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Question #1 of 4 :

    according to your initial post where you wrote

    Quote Originally Posted by abdo meghari View Post
    column B for PR-2023-00001sheet=column C for TT sheet=item code
    but with your initial post attachment following your direction
    just using Excel basics manually I can't get exactly your expected result in column E :

    Q1.jpg

    So is it a column error reference like Item Code instead of Description or
    did you make your bad attachment non matching your explanation ?

  54. #54
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    So is it a column error reference like Item Code instead of Description or
    did you make your bad attachment non matching your explanation ?
    OMG!!
    you're correct . should DESCRIPTION column based on result in file
    red lights doesn't seem to stop for lighting.

  55. #55
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    @JohnTopley
    it will shows application defined error if I add new range with same structure as in existed from the beginning .

  56. #56
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Question #2 ...


    Ok, a new green light !

    Next question : according to your post #36 last attachment for the PR-2023-00003 data is it normal the empty 'Sr' column ?

    Q2.jpg

    Different options in this case …
    If normal so very not a concern, nothing to do so Ok for a direct new green light !

    If not normal, it depends on if you want to just 'kick the a s s' of Dumb or Dumber who created such terrible table
    in order he warms a couple of neurons to at least better does his job (so nothing to do, light direct to green),
    if you want to manually correct the 'tt' worksheet (should condider green as well) or if you prefer a 'Sr' automatic numbering.
    In the last case, as 'Sr' is like an ID for each data row so the 'tt' worksheet Change event VBA procedure
    can not update anymore just the result worksheet relative cell to be changed but must reload all this worksheet data;
    anyway according to this small data attachment it's very not a speed concern.

    Your answer may also influence the fourth question …
    Last edited by Marc L; 03-03-2023 at 12:20 PM.

  57. #57
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Next question : according to your post #36 last attachment for the PR-2023-00003 data is it normal the empty 'Sr' column ?
    this is because I copy data manually . in realty will filled numbers 1,2,3 as in BS Q 4286.pdf file in last column ,
    if you want to manually correct the 'tt' worksheet or if you prefer a 'Sr' automatic numbering.
    Neither this nor that . will auto fill when import form original PDF file contains numbers and the word is ITEM not SR as in BS Q 4286.pdf file
    In the last case, as 'Sr' is like an ID for each data row so the 'tt' worksheet Change event VBA procedure
    can not update anymore just the result worksheet relative cell to be changed but must reload all this worksheet data.
    this is not problem to update data , then I will delete whole data in tt sheet and re- import again from PDF files to do that .

  58. #58
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Q2 and half ...


    So Ok, could be a green light until I read your comment about 'Sr' header
    as according to your initial post attachment two of three results worksheets use 'Sr' as header so why 'ITEM' for the third ?

  59. #59
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    I add a new PDF to the last file I posted and had no problem: but I am dropping out of this thread as I have done all I can to provide a solution.

  60. #60
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Ok John. But if I share some code I hope you could take it a glance …

  61. #61
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    as according to your initial post attachment two of three results worksheets use 'Sr' as header so why 'ITEM' for the third ?
    ok . I thought the header is ITEM in tt sheet but is COLUMN7 , so you can make it one single as SR .

  62. #62
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    I add a new PDF to the last file I posted and had no problem
    do you mean when add new file in ttt sheet then will add new sheet for this file? if it's so I will check again and attach your attaching .

  63. #63
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Yes added a new PDF to end of previous file and created the "new" PDF sheet.

  64. #64
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Question #3 ...


    Another trap is revealed in your post #36 attachment, something missing in your initial post explanation …
    Let's restart from the beginning in order to better understand my concept issue, so you wrote :

    Quote Originally Posted by abdo meghari View Post
    after split for BS Q 4286.pdf in column B should add to last item by short letters as in adjacent cell for ORIGIN column C which contain words based on matching between two columns in LISS sheet for each adjacent cell
    for instance :
    if the last item into cell IND for column B and the adjacent cell Indonesia for column C for BS Q 4286.pdf then the last item into cell for column B will become INDO based on matching between two columns in LISS sheet for each adjacent cell
    and if the last item into cell doesn't contain short letters then will add based on adjacent cell for ORIGIN column C like JAPAN to become in last item JAP for column B and if the last Item contains short letters like JAP or THI .... in column B then don't add any thing in last item …
    First your explanation is contradictory according to your own rules :
    A) « if the last item contains short letters like JAP or THI then don't add any thing »
    versus
    B) « if the last item … IND and the adjacent cell is Indonesia … then the last item … will become INDO » …

    Following rule A so rule B can't be applied ‼ So the elaboration should better be :

    according to column C lookup in 'liss' sheet for the SHORT text like for India its SHORT text is IND
    then if the last item in column B is different then replace it with the SHORT text - or if missing add it -
    like if column B last item is IND and column C is Indonesia so according to 'liss' sheet replace IND with INDO.

    Now that's clear and no more conflict as it is a single rule rather than your both !
    So this revisited rule well works with your initial attachment.

    But in your post #36 attachment a 'new country' appears : N/A ! I have no clue, maybe New Argentina, whatever …
    So following the rules, in particular the POLAND sample in your initial attachment when the country does not exist in the 'liss' worksheet,
    this is the result for PR-2023-00004 :

    Q3.jpg

    So is it the expected result ?
    If not, what must it be, what is the mandatory missing rule ?
    And you should better explain all the specific cases 'cause as a reminder
    I will post a one shot code so I won't modify it for what you forgot / misexplained …

    Such poor initial post attachment not well reflecting your real data just leads to a waste of time,
    maybe the reason why - with the foggy explanation - you did not receive any help during several days …

    As on my side it was the case, your initial post looks like you did not ever well understand your need !
    As always with your threads the difficulty is very not to write a code but to decypher your need, very time consuming,
    certainly the main reason why the helpers here on their free time, often short, prefer to directly move to the next threads
    in order to help several people well following the forum rules (whatever the Excel forum, it's the same)
    rather than consuming all their free time for your thread and finally won't help …
    Last edited by Marc L; 03-03-2023 at 08:52 PM.

  65. #65
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    First your explanation is contradictory according to your own rules :
    A) « if the last item contains short letters like JAP or THI then don't add any thing »
    versus
    B) « if the last item … IND and the adjacent cell is Indonesia … then the last item … will become INDO » …

    Following rule A so rule B can't be applied ‼ So the elaboration should better be :
    yes another my really bad !

    if the item contains IND in last item then will replace with of INDO but if there is no short letters and adjacent cell is INDIA then will add to last item is INDI
    and if the last item is INDI then should not add it .
    But in your post #36 attachment a 'new country' appears : N/A ! I have no clue, maybe New Argentina, whatever …
    So following the rules, in particular the POLAND sample in your initial attachment when the country does not exist in the 'liss' worksheet,
    this is the result for PR-2023-00004 :
    no this is new country and ignore that totally. I checked the original PDF file and when import data will be in excel like this
    450 N/A BRIDGESTONE BS 650R16 R230 JAP 31
    so the the last item should not add any thing because JAP is existed


    So is it the expected result ?
    If not, what must it be, what is the mandatory missing rule ?
    And you should better explain all the specific cases 'cause as a reminder
    I will post a one shot code so I won't modify it for what you forgot / misexplained …

    Such poor initial post attachment not well reflecting your real data just leads to a waste of time,
    maybe the reason why - with the foggy explanation - you did not receive any help during several days …

    As on my side it was the case, your initial post looks like you did not ever well understand your need !
    As always with your threads the difficulty is very not to write a code but to decypher your need, very time consuming,
    certainly the main reason why the helpers here on their free time, often short, prefer to directly move to the next threads
    in order to help several people well following the forum rules (whatever the Excel forum, it's the same)
    rather than consuming all their free time for your thread and finally won't help …
    my apologies !

    I really regret publishing such a bad topic, and the word bad does not express the truth of the matter, but rather it is a big mess. My mind is in another place I thought if we didn't understand each other well but now every word you were saying is true even though sometimes you use sarcastic expressions on the topic sometimes I should have accepted that as a result of publishing this topic in a disgusting way.
    I think after many publications and with John's wonderful help, I should review myself when raising a topic to include all the accurate and correct details instead of publishing a topic that does not benefit the forum and members.

  66. #66
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Q3 and half ...


    If I well understood N/A can't exist in the real data ? If so then it could be a direct new green light but as you wrote

    Quote Originally Posted by abdo meghari View Post
    when import data will be in excel like this
    450 N/A BRIDGESTONE BS 650R16 R230 JAP 31
    so the the last item should not add any thing because JAP is existed
    New issue here as JAP is not the last item ‼
    So according to the rules JAP is added after 31 so the final result is 450 N/A BRIDGESTONE BS 650R16 R230 JAP 31 JAP

  67. #67
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    New issue here as JAP is not the last item ‼
    So according to the rules JAP is added after 31 so the final result is 450 N/A BRIDGESTONE BS 650R16 R230 JAP 31 JAP …
    just I copy the whole row how could be when import from the file .
    each item is in existed in column . 31 is in existed in column SR
    QTY ORIGIN MARK BRAND SR
    450 N/A BRIDGESTONE BS 650R16 R230 JAP 31

  68. #68
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Still Q3 & half ...


    What a confusion ! So N/A exists ‼
    What is the rule to follow in such case ? Do nothing, not compare ORIGIN & BRAND so BRAND stays as it is ?

  69. #69
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    What is the rule to follow in such case ? Do nothing, not compare ORIGIN & BRAND so BRAND stays as it is ?
    the rule when the adjacent cell for last item contains JAP for N/A cell then keep the last item JAP
    if you see that is not sense , then I will clear N/A manually and write JAPAN and finish this problem.
    so what you think?

  70. #70
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Q3 ...


    So like I explained when ORIGIN equals N/A do nothing …

    Is N/A the unique ORIGIN specific case ?
    If not so the better is to follow John's way in order you will have no code modification to apply :
    only if ORIGIN exists in 'liss' worksheet.
    But in this case according to your initial post attachment where POLAND does not exist in 'liss'
    so the description is never updated with ' POL' at the end until 'liss' is updated.

    So what is your favorite : the way adding POL but hoping N/A is the unique specific case or John's way ?
    Last edited by Marc L; 03-04-2023 at 12:16 PM.

  71. #71
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    OK

    POLAND=POL
    N/A=JAP
    I will add to Liss sheet

  72. #72
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Q3 solved ...


    Ok so we follow John's way : when the country / ORIGIN does not exist in 'liss' so do nothing,
    check only the 'liss' existing countries for SHORT text as description last item …
    A new green light !

  73. #73
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Ok so we follow John's way : when the country / ORIGIN does not exist in 'liss' so do nothing,
    yes
    check only the 'liss' existing countries for SHORT text as description last item …
    I edited file .

  74. #74
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Question #4 : last but not least ?!


    According to your post #36 attachment this is the data extracted for PO-2023-000023 :

    Q4.jpg

    The first block is from 'tt' row #167 and the second from #223.
    Is it again just a bad copy you have done ? In this case that's a direct new green light.

    But if it can occur, any duplicate header row can be easily detected and removed
    but different options according to the Sr duplicates numbers …
    Last edited by Marc L; 03-04-2023 at 12:47 PM.

  75. #75
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Is it again just a bad copy you have done ?
    yes that's correct .
    but different options according to the Sr duplicates numbers …
    I'm not sure what you try to say .

  76. #76
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Ok, all lights are green ! But in case of new 'issue' or possible option during the coding process I may ask again …

    Do you really need result worksheets as Excel tables ?

    For the moment I see only one option : must the result worksheets be in the same order as within 'tt' or should be sorted ?
    Last edited by Marc L; 03-04-2023 at 06:59 PM. Reason: typo ...

  77. #77
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Do you really need result worksheets as Excel tables ?
    I want Tables if it's possible . but I don't make hard the thing if you prefer change to range it's ok( tt sheet is always contains TABLES I can't control of it)
    must the result worksheets be in the same order as within 'tt' or should be sorted ?
    if it's possible by sorting to arrange data .

  78. #78
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Ok for tables. I found another error within 'tt' worksheet but I bet it's again a bad copy you have done …

    For the sort, I was stating for the result worksheets names order only, not the data … So

    1) For the worksheets names order, the same than 'tt' aka BS Q 4286, PR-2023-00001, STOCK B.S TO 31-10-2022, PR-2023-00002 and so on
    or sorted like BS Q 4286, PO-2023-000022, PO-2023-000023, PO-2023-000024, PR-2023-00001 and so on ?

    2) Each result worksheet data is already sorted according to the 'Sr' column, do you need another sort, on which column ?

  79. #79
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    Ok for tables. I found another error within 'tt' worksheet but I bet it's again a bad copy you have done …
    definitely yes
    1) For the worksheets names order, the same than 'tt' aka BS Q 4286, PR-2023-00001, STOCK B.S TO 31-10-2022, PR-2023-00002 and so on
    based on tt sheet arranging
    2) Each result worksheet data is already sorted according to the 'Sr' column
    it's ok . keep as in SR column

  80. #80
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow How that works ...


    When the main VBA procedure ends a 'Rejected' message box may arise just indicating the count number
    then you can check in 'liss' worksheet columns E:F like in this fake sample :

    Reject.jpg

    • The question mark in cell E1 alerts the data structure does not match any of the three expected …

    • The number in E2 is the source name characters length which is superior to the max 31 a worksheet name can handle.

    Your post #36 attachment contains a source name with 32 characters length so should be rejected
    but just removing the '.pdf' filename extension so it is not rejected anymore,
    the reason why I have chosen for the result worksheets names to remove the extension …

  81. #81
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question How it may work, or not ...


    Quote Originally Posted by Marc L View Post
    As I don't know which way to go
    Since I recorded the questions screenshots I made my choice for a classic well known Excel basics relative to Question #4.
    Despite your answer where this Excel basics may not be the more efficient way to go
    - not very a concern according to your both small attachments -
    I keep this method in order to share a different way than John's …


    Quote Originally Posted by Marc L View Post
    Yes it can be achieved according to the attachment as it is
    so without modifying the 'tt' worksheet neither creating such 'ttt' helper worksheet
    Quote Originally Posted by Marc L View Post
    So just creating a stand alone VBA procedure
    for each data structure / expected result layout
    in order to use it whatever when splitting all names or
    when a change is made in 'tt' worksheet, the modular way !
    So the code should contain three data layout procedures,
    a procedure splitting all names and the Change worksheet event procedure …
    I changed my mind as after all it's just a beginner level data copy from 'tt' sheet to another sheet,
    so no need to over complicate, nothing advanced, more at beginner level, easier to maintain for a VBA novice …

    So just with an unique VBA procedure for the three data layouts rather than three stand alone procedures,
    the main procedure splitting the data to new worksheets as it deletes first any worksheet after 'tt' worksheet
    and if necessary the Change worksheet event procedure when a change is made within 'tt',
    all in a modular way for the parts used several times in order to avoid a classic beginner linear code with 300 codelines.


    Now it's an option part requesting an answer in order I may optimize the code :

    Quote Originally Posted by abdo meghari View Post
    it means any change in tt sheet should automatically change in others sheet
    Quote Originally Posted by Marc L View Post
    I mean after the 'tt' data split and arrange VBA procedure
    if you manually modify a cell within this 'tt' worksheet
    the relative split worksheet can be automatically updated - I was wrong yesterday -
    without launching again the split and arrange procedure …
    So the relative result worksheet cell can be updated when a cell is changed in 'tt' worksheet
    under some conditions the Change event procedure will detect and when necessary it could update all the result worksheet.

    But it should well work only with a smart enough user but may not work as expected when Dumb or Dumber operates the change …

    The classic trap is when several cells are modified at once :
    not an issue when all cells belong to the same source name
    as the Change event procedure will work only with the first changed cell relative source name
    - to avoid a gas factory code and a 'tunnel' effect freezing Excel for some time -
    and in case of several cells changed the relative result worksheet will be entirely updated.

    But when Dumb or Dumber changes at once data according to different source names
    as only the first source name relative worksheet will be updated
    so the only way to really update all the necessary result worksheets is to launch again the main VBA procedure …

    To avoid another tsunami effect if 'tt' worksheet module contains such Change event procedure :

    if the 'tt' worksheet data is imported via a VBA procedure so it's code must first desactivate the events
    before to update 'tt' and reactivate them at the end - like you will see in my code -
    or at least all the result worksheets must be deleted before to launch the import procedure
    but could be slower than normally as the Change event is still active …

    When all the 'tt' worksheet is updated manually with a Copy / Paste then all the result worksheets must be deleted before …

    Obviously not a concern when the 'tt' worksheet module has not a Change event procedure.


    So which option is your favorite ?

    1. An advanced 'tt' Change event procedure as described above (detecting if only a cell must be updated).

    2. A lighter 'tt' Change event procedure updating all the relative result worksheet
      even when only a cell is necessary to be updated …

    3. No Change 'tt' worksheet event so no automatic update when a 'tt' cell is changed,
      just needs to launch the main procedure …
    Last edited by Marc L; 03-05-2023 at 03:02 PM.

  82. #82
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    I don't want to comment for post#80 obviously all of mistakes you have found out because I copied data manually badly . so I will try clean file and attaching tomorrow .
    So which option is your favorite ?

    An advanced 'tt' Change event procedure as described above (detecting if only a cell must be updated).

    A lighter 'tt' Change event procedure updating all the relative result worksheet
    even when only a cell is necessary to be updated …

    No Change 'tt' worksheet event so no automatic update when a 'tt' cell is changed,
    just needs to launch the main procedure …
    I think I will choose option2 but if there is big difference for running speed then I will choose option3
    last thing : could be file name in column A like this
    PURCAHSE_MAR.PDF
    PURCAHSE1_MAR.PDF
    PURCAHSE2_MAR.PDF
    or you don't want extension at all?
    Last edited by abdo meghari; 03-05-2023 at 03:29 PM.

  83. #83
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    According to your both small attachments option #2 updating all a relative result worksheet is instant,
    maybe in less time than releasing the Enter key !
    The main VBA procedure creating all the result worksheets is fast enough.

    As I thought you'll choose option #1 or 3 according to how is created / updated 'tt' data …

    For the source file names, as I wrote « according to the attachment as it is » so you do not need to remove the file extension !
    Last edited by Marc L; 03-05-2023 at 03:37 PM.

  84. #84
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    ok this is your code and choose what you think is better
    Each method may have negatives and positives. It is better to choose the least negatives

  85. #85
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    I updated my previous post, read it if that can help you more to make your choice.

    If I may choose I wanna first know how is created / updated 'tt' worksheet …

  86. #86
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    option2 could be suitable, but I have question : could delete divided sheets before run the code ?
    the old divided sheets will be not matched with tt sheet when import new files . so should delete them and become useless.

  87. #87
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Both options #1 & 2 do not need to delete all the result (split divided) worksheets as it's just when a cell changed within 'tt'.
    Only the main VBA procedure needs to, like I wrote in post #81 :
    « the main procedure splitting the data to new worksheets as it deletes first any worksheet after 'tt' worksheet » …

  88. #88
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Let's start with a sample from a workbook containing only 'liss' & 'tt' worksheets : once the code implemented,
    you can create a button in order to launch the main VBA procedure splitting & arranging the 'tt' data to new individual worksheets.
    Then two cases :

    • Without any Change worksheet event :
      no issue when importing new data to 'tt' worksheet whatever via a VBA procedure or manually like via a Copy / Paste.
      But no automatic update in the relative result worksheet when you manually change a data within 'tt' worksheet
      so the only and unique way to update is to launch each time necessary the main VBA procedure …

    • With any Change worksheet event implemented to the 'tt' worksheet module :
      so if a cell is changed within 'tt' worksheet so its relative individual worksheet should be updated
      under conditions like explained in post #81 …
      But it can be a slow mess, may lead to an Excel crash or even a system crash, when another VBA procedure
      like when importing all data to 'tt' worksheet does not desactivate the events just during its process
      or when an entire data Paste is applied to 'tt' …

    As you do not answer how 'tt' data is allocated …

  89. #89
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    If you have well read post #81, Option #2 - like Option #1 - updates only the unique individual worksheet relative to which 'tt' cell changed …
    The difference between both is Option #1 trying to be smarter with updating only the necessary when possible
    rather than Option #2 updating all the relative unique individual worksheet even when only a 'tt' cell changes …
    Well notice above like in post #81 I did not write worksheets but worksheet without an 's' so a single unique one.

  90. #90
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    As you do not answer how 'tt' data is allocated …
    what do you mean ?
    can you clarify more pleas?

    If you have well read post #81, Option #2 - like Option #1 - updates only the unique individual worksheet relative to which 'tt' cell changed …
    The difference between both is Option #1 trying to be smarter with updating only the necessary when possible
    rather than Option #2 updating all the relative unique individual worksheet even when only a 'tt' cell changes …
    Well notice above like in post #81 I did not write worksheets but worksheet without an 's' so a single unique one.
    now definitely I select option1
    EDITED FILE: post#36 with simple adjusting.
    Last edited by abdo meghari; 03-06-2023 at 03:56 AM.

  91. #91
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question New set of questions ...


    According to your post #36 new attachment :

    1. Crucial difference with your both previous attachments in cell A1 which contains now the first filename
      versus the previous containing 'Source.Name' as header : so which is the 'good one' when you receive the data ?!

    2. The source 'tt' data as individual worksheet column 'Sr' from PO-2023-000022 has duplicates and
      PO-2023-000024 has a missing number or is not well numbered :
      new strategy to deploy or just again a bad copy you have made ?

  92. #92
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    versus the previous containing 'Source.Name' as header : so which is the 'good one' when you receive the data ?!
    I think you have informed me for this error , if you are comfortable with previous file before updating so ignore modification . actually when import data will add Source.Name in A1 so what you decide about that ?
    The source 'tt' data as individual worksheet column 'Sr' from PO-2023-000022 has duplicates
    I don't see any duplicates numbers for SR column , and I don't think to adjust anything for PO-2023-000022 file
    PO-2023-000024 has a missing number or is not well numbered :
    you mean in column A , right?
    sorry yes that's correct .
    new strategy to deploy or just again a bad copy you have made ?
    there is no new strategy .
    EDITED File

  93. #93
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    To be sure when you import 'tt' data : the original cell A1 is a filename or 'Source.Name' ?

    As this is the post #81 main question to avoid a crash with the Change worksheet event so how do you import the 'tt' data ?

  94. #94
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    To be sure when you import 'tt' data : the original cell A1 is a filename or 'Source.Name' ?
    OK keep 'Source.Name' as what happens when import data .
    so how do you import the 'tt' data ?
    as I said from PDF files will add files names in column A except A1 will be Source.Name.

  95. #95
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    Quote Originally Posted by abdo meghari View Post
    as I said from PDF files
    As 'from PDF' is only the source data but does very not indicate how do you import the data so at least explain !
    Last edited by Marc L; 03-06-2023 at 09:39 AM. Reason: typo ...

  96. #96
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    the only way to do that by office 365 is existed at work to convert PDF to excel.

  97. #97
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    So if it is an Excel 365 feature you manually use
    so such Change worksheet event may interfere and could very slow down the process or even may lead to a crash …

    So rather than writing 50 codelines for such event which may be a mess this is another alternative close to Option #2 but semi-automatic :
    once you finish to change data for an unique filename within 'tt' worksheet then its relative individual worksheet is updated
    when you double click or right click - to choose - on the filename within column A ?

    If you process changes for different filenames you have the choice to just activate the event for each filename
    or to just launch again the main VBA procedure like when you import new data …


    According to your new post #36 attachment I will use the 'tt' worksheet used range
    as I can't trust anymore the table location including only rows #1 to 100 but the last data is in row #260 !

  98. #98
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    A doubt according to your initial explanation :

    Quote Originally Posted by abdo meghari View Post
    also will add new ranges for tt sheet with the same structure as in attachment .
    What that really means ?
    You add new ranges for new filenames non existing when you import data from pdf files
    or you just modify data for only existing filenames with their individual worksheets already created ?

    For the first option so any worksheet event procedure is useless as for new filenames the main procedure must be launched.
    In this case that will very simplify & reduce the code, just two procedures, one is a sub level called by the main,
    its execution may be slightly faster …

  99. #99
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    as I can't trust anymore the table location including only rows #1 to 100 but the last data is in row #260 !
    what do you mean?
    What that really means ?
    add new files are not existed totally and modifying data for files names are existed .

  100. #100
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    I mean exactly what I wrote : the table does not contains all the data rows but only the first hundred !
    Not a concern with the worksheet used range rather than trusting the table range …

    Ok so you may add new filenames not existing in the imported data from pdf so what is your favorite option ?

    1. A click event like explained in post #97 - so requiring which click event you prefer - and
      if the individual worksheet does not exist it is added respecting the 'tt' filenames order.

    2. No click event procedure as explained in post #98 for a lighter code just with the main procedure.
    Last edited by Marc L; 03-06-2023 at 09:02 PM. Reason: typo ...

  101. #101
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    No click event procedure as explained in post #98 for a lighter code just with the main procedure.
    ok this option could be enough.

  102. #102
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this !


    According to your attachments an one shot Excel basics VBA code to paste only to the Worksheet____4 (tt) module :
    Please Login or Register  to view this content.
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  103. #103
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    currently testing ......
    will come back later

  104. #104
    Forum Contributor
    Join Date
    12-02-2020
    Location
    Asia
    MS-Off Ver
    2010 & 2016 insider(Windows 10 64-bit)
    Posts
    724

    Re: split Tables into multiple Tables for multiple sheets with different structure & arran

    great!
    it works without any problem
    thanks for this work

  105. #105
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: split Tables into multiple Tables for multiple sheets with different structure & arran


    First, thanks for the rep' !

    12 days for a solution, an average for your future threads ? …

    Quote Originally Posted by abdo meghari View Post
    My mind is in another place
    […] I should review myself when raising a topic to include all the accurate and correct details
    Never create a thread until you have well understood your need and your mind is not aware but 100 % focus.
    Yes accuracy leads to a quicker solution …
    Last edited by Marc L; 03-07-2023 at 11:31 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 03-04-2022, 08:30 AM
  2. Replies: 6
    Last Post: 04-22-2021, 03:41 PM
  3. Replies: 7
    Last Post: 11-28-2020, 06:55 PM
  4. Delete and add rows to multiple tables on multiple sheets using inputbox
    By Oliver_watkins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2020, 04:56 AM
  5. Copy Paste multiple tables from multiple sheets into Outlook email
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2015, 12:21 PM
  6. Pivot Tables - need to do separate pivot tables for multiple sheets in same format
    By tconnell1965 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 07:04 AM
  7. [SOLVED] Split a long table to multiple tables
    By amasson in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-02-2013, 05:37 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1