+ Reply to Thread
Results 1 to 38 of 38

CUT specific Row from a table and paste in another table in the same sheet based on value

  1. #1
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    CUT specific Row from a table and paste in another table in the same sheet based on value

    Hello

    I have a spreadsheet with TWO tables with identical format and 600 odd rows showing "Unit Details" in each row, the second one is placed right below the first one in the same worksheet.
    The last column of my table shows the status of each unit i.e. SOLD or UNSOLD.

    The Top table shows Units with "SOLD" in Status column and the Bottom Table Only Shows units with "UNSOLD" in the status column.

    Currently, I am doing this manually i.e. Once the unit is SOLD , I manually CUT it from the bottom table and paste in the Top table in Alphabetical sequence. Each unit should appear only Once i.e. either in the bottom table or in the top table.

    Is there a way to automate this process i.e. If I Type "SOLD" in the Status column the entire row is shifted (Cut-Pasted, NOT Copy-pasted) from the bottom table to the Top Table and vice versa, if I type "UNSOLD" in status column that row should be in the bottom table already or shifted to Bottom table from Top table. The total number of units should always match the exact number i.e. can not be duplicated in both the tables.

    I have attached a sample sheet showing two tables for your reference.

    Thanks in Advance

    V
    Attached Files Attached Files

  2. #2
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Please post a file which represents your actual layout: having tables one beneath another is not sensible (if this is the actual format).!
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Hello John, the file has actual format. The tables are below one another. Unfortunately Its the Government format that we have to follow. As its printed on the same page lateron while submitting the report.

  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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    So if 3 UNSOLD are SOLD (in your example) what happens? So the starting rows of the tables dynmic with 2 rows between bottom Table 1 and top of Table 2 bottom?

  5. #5
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Any rows in bottom table that become "Sold" is shifted to the top table , in its ascending alphabetical position....

    As the rows in top table increase, the bottom table is pushed further down always maintaining a gap of 2 or 3 rows between the tables...i.e. between last row of top table and header row of bottom table.

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    This is quite a tricky one...Start with this...
    Based on you making use of "SOLD" & "UNSOLD"

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Sintek; 09-27-2024 at 02:22 PM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  7. #7
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    A couple of "tweaks" ( ....

    Please Login or Register  to view this content.

  8. #8
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Am certain it will need a couple more...
    Need to still identify how entries will be added...
    What happens if all UNSOLD become SOLD and no row below headers etc etc...
    Am certain there will be other scenarios to still take into account...

  9. #9
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Thanks a ton John... That Works Brilliantly. Exactly what I was trying to achieve.

    Want to Request one more help if possible..... It shifts rows smoothly between SOLD & UNSOLD tables. My table has UNIT Nos ranging from A-101 to A-1306. (Approx. 78 Units). When I convert unit No. A-1001, A-1002,......A-1006 to SOLD, they are placed above A-101 instead of being place below the A-9 series i.e. A-901, 902, 903... etc

    Could you please suggest how I can fix this? Thanks again for your prompt help.

  10. #10
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    First and foremost, the code was from Sintek [Post #6 to which I added very minor "tweaks"] so ALL credit is due to him: and please read post #8 where Sintek poses questions that need to be answered.

    The sort sequence is the common problem with sorting alpha-numeric data: I will leave any solution to Sintek to avoid any more answers being wrongly attributed to me.
    Last edited by JohnTopley; 09-28-2024 at 03:23 AM.

  11. #11
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    My sincere apologies Sintek for my ignorance and thanks John for pointing it out to me.

    Could you please guide me Sintek?

    Thanks

  12. #12
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    And the plot thickens...A custom list sort would be ideal here...sadly it has it's limits...
    Try this manipulation...must admit...i have never seen a sheet event this complex...
    Would have beenn so much easier if the tables were on different tabs or next to each other...
    Please Login or Register  to view this content.
    Last edited by Sintek; 09-28-2024 at 04:04 AM.

  13. #13
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Hello Sintek, your latest code is working vwery well in sample sheet. But its causing a problem in my actual sheet as I have multiple prefixes i.e. A-101, B-101, C-101 and so on. When I added your new code to the sheet, its clubbing all the prefixes for a number in one cell ....i.e. A-B-C-101

    Could you please help !

    Thanks

  14. #14
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Oh my gosh...Really????
    My table has UNIT Nos ranging from A-101 to A-1306. (Approx. 78 Units). When I convert unit No. A-1001, A-1002,......A-1006 to SOLD, they are placed above A-101 instead of being place below the A-9 series i.e. A-901, 902, 903... etc
    So why not mention this in the first place...Obviously above will not work...

    Hello Sintek, your latest code is working vwery well in sample sheet.
    The joys of not being transparent from the getgo...

    No time now...Will look at it after the weekend...I suggest uploading a sample file with actual data setup so no time is wasted on supplying incorrect code...Aswell as showing a before and after with this supposed sorting the way you want...
    Perhaps someone else will hop on board and offer a solution...i'm guessing as a custom list is not possible and above cannot work...Either a helper column or a loop...

    Either way...Just don't have the energy right now...
    Last edited by Sintek; 09-28-2024 at 12:41 PM.

  15. #15
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    My Sincere apologies Sintek for the trouble. Didnt realise the impact not mentioning various suffixes would have on the code.

    As suggsted by you, I have attached a sample file with all the necessary details.

    Thanks
    Attached Files Attached Files

  16. #16
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Hello Sintek, your latest code is working vwery well in sample sheet. But its causing a problem in my actual sheet as I have multiple prefixes i.e. A-101, B-101, C-101 and so on
    No ... I'm sorry...This is even worse than initially posted...
    I mean look at this...Your initial sample was entries consisting of A-101, A-102 etc...
    You then mention different suffixes...I was taliking about prefixes...Now you come with this...

    A-101
    OFFICE 04
    OFFICE 01-F
    UL1
    UL12
    L12
    L1201
    B-1202


    Now you even have pre & suf fixes, dashes|no dashes, spaces|no spaces????
    And to add to that...now even a total row???
    And also no before|after expected result shown suggesting that you yourself have no idea what the accurate sorting result should be...
    This is a nightmare...I suggest you review your design and layout of this...

    As per John...

    The sort sequence is the common problem with sorting alpha-numeric data:
    I agree especially with such vast different Alpha-Numeric sequences
    Last edited by Sintek; 10-01-2024 at 10:18 AM.

  17. #17
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    .... Even the table headings are not consistent!

  18. #18
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Since this format was used/updated manually all this time, it didnt matter if a few unit numbers missed a dash or headings were different. But now since I have taken over the sheet updating part, I will ensure that the unit number formats are consistent i.e. All have a dash, headings of the two tables are consistent etc.

    If you see any other part of sheet that may potentially cause problems with the code, I can fix/modify that too, provided I know. I would appreciate you help !

  19. #19
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Look...As is, I can offer a solution...Am actually working on one now...

    The issue was your lack of transparency and continued criteria changes...
    What does it help asking for a solution if you don't give all the information...This is just a waste of time...

    Yes, I suggest first fixing your file to have an accurate representation and then I will gladly continue...
    Last edited by Sintek; 10-02-2024 at 03:22 AM.

  20. #20
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    My attempt ..based on Sintek's code ...

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  21. #21
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Let's hope the next sample file which depicts "accurate reflection of data" is similar to previous sample files...

  22. #22
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Thanks John its working perfectly and yes Sintek actual file is exactly same as this one ( except that now its cleaner and with no mistakes )

    Just one last thing John, the Dynamic total at the bottom of each table isnt updating automatically. I tried adding the sum function , but the sum range is not getting updated when the units are shifted from bottom table to top table.

  23. #23
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    On checking the total (logic for) , I do not believe it is working correctly. I need to take another look at the logic for getting the start row/ end row for each table.

  24. #24
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Hey guys...No access to pc for the weekend...
    @vikrampnz...
    Pls upload a sample file representing actual Alphanumeric numbering in the meantime and file representing actual setup...Cannot imagine that you have all those empty rows above and empty columns to left...

  25. #25
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Try the attached
    Attached Files Attached Files

  26. #26
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    UPDATED file ("SR No" corrected)
    Attached Files Attached Files

  27. #27
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    @ John...
    As you supplied I cannot imagine it to be the accurate representation as per OP comment...
    except that now its cleaner and with no mistakes
    Will await updated as per above...

  28. #28
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    @Sintek: well... I gave it go!

  29. #29
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    @ John...

    I gave it go!
    Yes...All worked as it should with supplied inaccurate representation of file...

    Was merely addressing OP comments...
    Since this format was used/updated manually all this time, it didnt matter if a few unit numbers missed a dash or headings were different. But now since I have taken over the sheet updating part, I will ensure that the unit number formats are consistent i.e. All have a dash, headings of the two tables are consistent etc.
    Which you too eluded to...
    .... Even the table headings are not consistent!
    No new file since then...No use wasting time unless OP supplies his accurate file...
    Last edited by Sintek; 10-03-2024 at 03:29 PM.

  30. #30
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Hello, sorry for late response....was travelling.

    I have attached a clean file with exact consistent data. I have removed all the previous codes from it to keep it simple.

    I have made following changes to it, which were not there before:

    1) Some unit numbers have an alphabet suffix "F" e.g. "OFF-1F". Prefixes remain to be A,B,C,L,U,OFF.

    2) Status Has two more categories - "Consideration" & "GOVT." ....... these units will always remain in the bottom table as they are not for Sale.

    I am assuming that anything other than "SOLD" will remain in the bottom table and hopefully having more
    status categories wont affect the code. "UNSOLD", "CONSIDERATION" & "GOVT." will always remain in bottom table.

    3) I have added a "TOTAL UNITS" field (which is a total of units in top table & bottom table) in the left top corner of the sheet to tally that the total number of units hasn't changed.

    The columns that are left blank to the left of the tables and blank rows above top table and bottom table are required like that as my table headings go there.

    Hope this is in line with your requirement Sintek & John. If you need me clarify anything else, please let me know.

    Thanks a lot
    Attached Files Attached Files

  31. #31
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    The columns that are left blank to the left of the tables and blank rows above top table and bottom table are required like that as my table headings go there.
    So why not add them as per original file setup...All this plays a role in correct provided code...
    Please...Supply a sample file that represents your actual file setup...
    As per above one can see that this has changed so so so much since first post...HELP US HELP YOU...
    Last edited by Sintek; 10-04-2024 at 05:55 AM.

  32. #32
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    See attached but I echo Sintek's request that you post a sample file that represents your actual file setup.
    Attached Files Attached Files

  33. #33
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Dear Sintek & John, the file attached today is exactly what the original file looks like....nothing less, nothing more !

  34. #34
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    No file attached to last post.

  35. #35
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    There is a file called "Table Sample V.02.xlsm" which was attached to my post with a long explanation.

  36. #36
    Forum Contributor
    Join Date
    06-24-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    101

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Thanks John & Sintek for your patience and help ! John, your last file works like a dream.

    Thank you both for patiently putting up with the shortcomings in the data supplied by me.

  37. #37
    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
    29,532

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    Good news!


    For future reference: post files which reflect your actual file to avoid any respondents possibly wasting time and effort constantly revising solutions.

  38. #38
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    14,125

    Re: CUT specific Row from a table and paste in another table in the same sheet based on va

    I see John has solved...Glad you got it sorted...
    Just for closure...From my side...

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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: 1
    Last Post: 05-11-2021, 04:58 PM
  2. Copy dynamic range from closed workbook paste as table into specific sheet
    By Huskersippi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-16-2019, 11:35 PM
  3. Replies: 2
    Last Post: 07-24-2017, 02:40 AM
  4. Macro: Copy/cut all rows matching criteria, and paste into specific Table/sheet
    By Andrewjs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2017, 03:55 PM
  5. Replies: 8
    Last Post: 09-16-2013, 11:01 PM
  6. Macro to copy a table and paste in another table (based on certain conditions)
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-22-2013, 01:14 PM
  7. Copy table information and paste sorted based on specific field.
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2005, 12:05 PM

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