+ Reply to Thread
Results 1 to 87 of 87

xladept Script Adjustment - Combining Two Sheets

  1. #1
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    xladept Script Adjustment - Combining Two Sheets

    Okay so xladept (you rock!!!) helped me create/adjust some macros that would compare two sheets and combine them keeping original values. It has worked flawless since we finished it.

    I am trying to modify the same script for another workbook - the only difference is that in the original, the macro would compare COLUMN A for matching and then past the columns as you see here

    Please Login or Register  to view this content.
    My new sheet all I need to change is so that it matches a different column (most likely column E)

    There are several instances of Column A in this form so I am not sure which one to change. I tried a few but with no avail. I think I had it once but then lost it...lol.

    I tried to read the code and understand what is happening but my small brain was not able to comprehend what the code is doing.

  2. #2
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Oh wow, I am stupid. I changed all instances to E and it worked. I had forgot I need to add in my lookup formulas from all the other columns to complete the table.

    #moron

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    If the New is on column E then just change:

    Please Login or Register  to view this content.
    To:

    Please Login or Register  to view this content.
    *Nevermind since you already figured it out
    Last edited by xladept; 10-12-2017 at 01:32 PM. Reason: Nevermind
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  5. #5
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Quote Originally Posted by xladept View Post
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    You are literally my favorite person next to my wife, and maybe my kids (lol).

    Do you think you could walk me through (explain) the code. Rather than always ask I would love to be able to read the code and understand what it is doing. If it's not too difficult that is.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Thanks for the rep - hope this is clear:

    Please Login or Register  to view this content.
    *BTW - why aren't we adding the whole record?
    Last edited by xladept; 10-12-2017 at 03:09 PM.

  7. #7
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    What do you mean? I am so far gone and lost on this that I don't even know what is happening anymore.
    What do you mean by adding the whole record?

    While I am here I was hoping you could help me with another question that has not come up before. Sometimes my data list (Merge sheet) has the same NUMBER in the column we are filtering from, when this occurs it adds that item in twice on the complete form, is there a way to get around that?

    In short the data field I am merging by is a Sales order number, there is another column that contains a part number. Sometimes there are multiple part numbers on the same sales order so there would be say 3 lines for the same SO number with different part numbers.

    What is happening is that it is creating two rows for those in the final sheet. The problem of course is then my INDEX MATCHES are incorrect because its looking up the sales number and stopping at the first one.

    I don't think I explained that very well LOL.

    tl;dr - Is there a way to INDEX/MATCH when there are multiple rows with the same looked up value (As in it looks it up, pulls the data, recognizes that its the same value again and goes to the next row of that lookup value)
    Last edited by NewYears1978; 10-19-2017 at 12:37 PM.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    We're just writing the first field of the new record but could write the whole record.


    Please Login or Register  to view this content.
    * I'll be considering the rest of your post.

  9. #9
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Ah, that might solve the whole problem.

    When you originally wrote it, I requested it that way I believe, because I only wanted it to take the CUSTOMER ID number, it was merging that with an existing list (in another part of my macro) and using VLOOKUP to pull the current data. I think it was faster processing to not have to copy the entire row of data, but rather one value (maybe).

    I'm sure it would work another way but it worked perfect for my customer list.

    Might be possible to change it for this application to be more efficient. Maybe having it pull the whole row of data would solve the issue - I don't know? It works great how it is other than the INDEX MATCH where the lookup value is duplicated.
    Last edited by NewYears1978; 10-19-2017 at 12:57 PM.

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Well, that would wipe out your formulas, which don't seem to be working anyway??

    Is there a different sample, there is no Merge sheet on the one I have?

  11. #11
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Ah yeah the sample is really hard to use without being here at my location, it imports a file on a shared drive, it then also adds a similar row to the Merge Tab and the Backorders Tab (otherwise your sub breaks when it doesn't find at least one match)

    I can attach a current copy but it will be hard to test locally I think, I'll provide one with an already setup Backorders and Merge tab so you can just run the BackOrdersCombine macro...I will include some dupe rows.


    Just runt he BackOrdersCombine macro - you'll see that it's duplicating 2 rows - because there are two rows in MERGE with the same lookup value and of course it's only copying the data from the first row it finds in the index match.


    (The formulas work, it's something we weren't able to fix before in the code, I had to add code to create a like record on both sheets so that it continues to work
    Attached Files Attached Files

  12. #12
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Well, I got all three rows and the WDONOTDEL row at the top? What needs done?

  13. #13
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962
    Quote Originally Posted by xladept View Post
    Well, I got all three rows and the WDONOTDEL row at the top? What needs done?
    Okay so if you notice the bottom two rows. They have the same sales order number which is the match column. But the rest of the columns should be different for each row. Look on merger tab

    It’s matching the first row in merge and pulling that data

    Maybe there’s a way to match two columns. The sales order AND part code column?

  14. #14
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Ah yeah the sample is really hard to use without being here at my location, it imports a file on a shared drive, it then also adds a similar row to the Merge Tab and the Backorders Tab (otherwise your sub breaks when it doesn't find at least one match)

    I can attach a current copy but it will be hard to test locally I think, I'll provide one with an already setup Backorders and Merge tab so you can just run the BackOrdersCombine macro...I will include some dupe rows.


    Just runt he BackOrdersCombine macro - you'll see that it's duplicating 2 rows - because there are two rows in MERGE with the same lookup value and of course it's only copying the data from the first row it finds in the index match.


    I guess once easy solution would just be to remove the other lines with the same sales order number on the merge tab before merging.

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Here's "M" :

    Data Range
    M
    1
    SalesOrder
    2
    WDONOTDEL
    3
    W00673432
    4
    W00673379
    5
    W00673279

  16. #16
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Yes that is correct but it's doing INDEX MATCH on the Merge sheet and it's only matching the first row with that order number..if that makes sense?

    I need it to match one row, then the next row..if that's even possible? If not I will just remove duplicates before running the macro so it only shows one row.

  17. #17
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Well, I changed one of the 160's to 170 and it caught it????

  18. #18
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Yeh I have no idea..it might be better to just remove the second row but I think my boss will want both rows on there lol.

    I'm sure index match can do an IF or AND function? I could match Column M AND Column S?

  19. #19
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    For M & S:

    Please Login or Register  to view this content.

  20. #20
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I think that worked, will test further, thanks!

    Edit:
    Oh man I think it didn't work after all still doing same thing
    Last edited by NewYears1978; 10-19-2017 at 05:58 PM.

  21. #21
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    How can I test that "same thing"?

    Thanks for the rep

  22. #22
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    If you run the macro in the same sample I give you'll see that it is not working..it's listing the same part number (Column S) for both rows (as well as all the other data)

    See image of the Merge tab, then the results on the Backorders tab
    Attached Images Attached Images

  23. #23
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    I changed the S entries to 1,2,3:

    Data Range
    M
    N
    O
    P
    Q
    R
    S
    T
    1
    SalesOrder
    OrderDate
    ExternalOrderNum
    CaptureHh
    CaptureMm
    OrderStatus
    StockCode
    OrderQty
    2
    W00673432
    Oct 11 2017 12:00AM
    5084310
    12
    46
    1
    LEV-1461LHC-SP
    80
    3
    W00673379
    Oct 11 2017 12:00AM
    5084240
    12
    37
    1
    LEV-1462LHC-SP
    90
    4
    W00673279
    Oct 11 2017 12:00AM
    5084104
    12
    14
    1
    LEV-1463LHC-SP
    140
    5
    WDONOTDEL
    6


    And it output the 1,2,3

    Data Range
    M
    N
    O
    P
    Q
    R
    S
    T
    1
    SalesOrder
    OrderDate
    ExternalOrderNum
    CaptureHh
    CaptureMm
    OrderStatus
    StockCode
    OrderQty
    2
    WDONOTDEL
    0
    0
    0
    0
    0
    0
    0
    3
    W00673432
    Oct 11 2017 12:00AM
    5084310
    12
    46
    1
    LEV-1461LHC-SP
    80
    4
    W00673379
    Oct 11 2017 12:00AM
    5084240
    12
    37
    1
    LEV-1462LHC-SP
    90
    5
    W00673279
    Oct 11 2017 12:00AM
    5084104
    12
    14
    1
    LEV-1463LHC-SP
    140
    Last edited by xladept; 10-20-2017 at 11:04 AM.

  24. #24
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Maybe I incorrectly tested or didn't run the right code. I will check again when I am back at work next week! TY!

  25. #25
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    You're welcome - we can always paste the entire record!

  26. #26
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Pasting the entire record might work.


    The new script still didn't work for me, I always end up with the same data on each row and it also seems to make it delete my formatting, which the old code does not.

    I think better to leave it as is. Pasting the whole record would mean I no longer need the INDEX MATCH formulas though..not sure why we didn't do it that way originally..seems more efficient? lol

    But if it ain't broke, don't fix it????

  27. #27
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    But it's broke, aint it?

  28. #28
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    It's half broke..well it's partially broke...LOL. My boss wanted to use the form as it was so it's already in use, changing it now will mean everyone has to start fresh :D Sure would be more efficient though.

  29. #29
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Well, I've got an interview this morning. I'll see what I can do later

  30. #30
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Here it is for the first 36 fields:

    Please Login or Register  to view this content.

  31. #31
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I will try that

    Edit:

    It works but it doesn't seem to do what I need it to do, it just replaces all the lines with the new lines.it doesn't "merge" the two sheets of old and new data. I think that's the reason I had to use the VLOOKUP to match only one thing?
    In other words if I run this, put notes in, run it again, it just removes all the lines and readds them.

  32. #32
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I thought about revisiting this but didn't know if you thought you might have a solution xl-

    I couldn't get the prev script to work - you've probably forgotten all about it now

    Refreshing memory - when it merges if there are two customers the same it pulls them twice but it only puts the data from the first match so:
    Please Login or Register  to view this content.
    Notice that the Sales order number is the same, which is what i use for the lookup on my INDEX MATCH ...but the Part numbers are two diff ones..when I merge right now what happens is it puts both these lines but all the data from the first line..I need it to retain all the data from both lines.

    Any ideas on that? I think you sent me a script before that was supposed to match all fields but it didn't work out for me (I will test again).

    EDIT
    Actually I lied, I just retried your last formula
    Please Login or Register  to view this content.
    And it worked this time...I must have done something wrong before! Lol..ugh so this post..was a waste! SORRY!!!

    Only thing I need now is it to NOT overwrite my Columns AL, AM and AN as those are note fields that need to return. New script erases those. I tried changing the 36 to 33 but that didn't work. Probably something simple?
    Last edited by NewYears1978; 01-12-2018 at 12:33 PM.

  33. #33
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Column AN is the 40th column - the sample had no data in those three columns and the e-mail link wasn't included

  34. #34
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Right, the last column on the tab that gets merged is AJ, but on my main Tab where the merging happens there is a Column AK-AN, AK is a formula that just gets copied down..and that field is working..however Column AL AM and AN are notes so people can type in notes for that line, the merge script is blanking those lines out rather than keeping them for some reason.

    Attached a new sample
    Attached Files Attached Files
    Last edited by NewYears1978; 01-12-2018 at 02:17 PM.

  35. #35
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Here's the code that obliterates those comments:

    Please Login or Register  to view this content.

  36. #36
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I commented those out and it seems to work - yay. You rock! Well, I commented the whole block out, I hope that was correct - haha.

    Oh wait, that just appended them on bottom instead of deleting..lol Woops.
    Last edited by NewYears1978; 01-12-2018 at 04:17 PM.

  37. #37
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    If it's working great, if not we'll attempt a rewrite. Thanks for the rep!

  38. #38
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    No, when I comment those lines out it appears to just append all the lines to the bottom instead of deleting and adding

    Oh see now, because this script is removing the whole line then repasting it..I don't believe the old script we used did that..(I guess?)

  39. #39
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    @xl - here's the file we talked about.

    (The second tab is hidden called Merge)

    You can kinda see what is happening, I have an import macro that pulls new data from a file on shared hard drives here at work, and it pastes it into the Merge Tab. Then your script Combines the Backorders and Merge tabs..just by mastching the SalesOrder column.

    The issue is that the SalesOrder column sometimes is duplicated on the Merge tab, but there is a diff part number (StockCode tab). So since I use INDEX MATCH what is happening is your script is pasting the same SalesOrder multiple times (for each instance of StockCode) and then my Index Match is only returning vlues from the first match on the Merge tab.

    Does that make sense?

    Or is there such index match that can match the same value and take in to account skipping the one already matched? (So if you matched a value it then ignores that cell on the next run to match the same value on the next row???)
    Attached Files Attached Files

  40. #40
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Here is the result of the BackOrderCombine macro - please critique. The program doesn't use index match so, I think the output is correct at this stage - if I'm wrong please tell me where:
    Attached Files Attached Files

  41. #41
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    It's working but I have some conflicting stuff breaking it so I have to work on making the rest of my stuff work with the new code. (Currently if I run it twice it will start to copy down my index formulas again which will break it)

    When I run the code (just BackOrderCombine..it keeps readding back in INDEX match formulas even though I have deleted them..can't figure out why)
    Last edited by NewYears1978; 02-23-2018 at 05:39 PM.

  42. #42
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Check this out, if I manually delete some rows and rerunt he macro..all the new rows now have INDEX MATCH in them...no clue why there is no code telling this to happen!?!?

    Look at rows 7 and beyond.

    I can't figure out what is happening. Also if I don't have that BLANK WDONOTDEL line in there it won't work..there always has to be one match or it won't work..I think it may also be what is causing it to break?
    If I delete all the rows and the index matches out of the top WDONOTDEL row then when I run the macro it just puts all blanks in instead of the data.
    Attached Files Attached Files
    Last edited by NewYears1978; 02-23-2018 at 05:50 PM.

  43. #43
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    This is the correct version of the BackOrderCombine:

    Please Login or Register  to view this content.

    The earlier version keeps propagating - if you'll replace all versions with this then the issue may well be resolved!

  44. #44
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I think that worked, will do some more testing thanks!

    Just gotta add some formatting that will highlight diff colors for the rows with the same SalesOrder so they'll now..woo.
    Last edited by NewYears1978; 02-23-2018 at 06:45 PM.

  45. #45
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Stick this red code in the routine:

    Please Login or Register  to view this content.
    Last edited by xladept; 02-24-2018 at 01:14 PM.

  46. #46
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I think I have a problem that I had previously...it seems like the routine is rewriting EVERY line which means that my custom columns are being deleted..but they need to stay (Columns AL-AN) and also formatting is being wiped. I remember this is what happened a couple pages back when you tried to rewrite it.

    I could swear I tested this at work though and it didn't delete everything but here at home it is...weird?
    Last edited by NewYears1978; 02-23-2018 at 10:03 PM.

  47. #47
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Make sure you're using the latest version - it only writes the first 36 columns.

    Thanks for the rep!

  48. #48
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I am, I just pasted the new one..not sure why it's going wonky...will keep checking maybe something funky going on here.

    I can see it rewriting the whole line...even though I have the right code..I have no clue why...Ahhhhhhhhhhhhh this file will be the death of me.

    I'm going to post a video showing what it's doing lol
    https://youtu.be/lXywhKDDdCM

    (Are YT links allowed?)
    Last edited by NewYears1978; 02-23-2018 at 10:24 PM.

  49. #49
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    But it only does that at home??

  50. #50
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Maybe. I will have to check at work on Monday. It was RIGHT at the end of the day so I was testing fast..but I seem to recall it working..why would it be diff at home and work...same Excel? So strange lol

  51. #51
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Perplexing!

  52. #52
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    I've found the problem - there was an indexing error, totally my fault - here's the corrected correct version:

    Please Login or Register  to view this content.
    * Do we now have new problems??
    Last edited by xladept; 02-24-2018 at 01:59 PM.

  53. #53
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    To handle the perceived problems try this version:

    Please Login or Register  to view this content.
    Last edited by xladept; 02-24-2018 at 07:11 PM.

  54. #54
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,256
    Quote Originally Posted by xladept View Post
    To handle the perceived problems try this version:

    Please Login or Register  to view this content.
    Xladeft how if union sheet1 and sheet2 this is posibel ?
    Please Login or Register  to view this content.
    Last edited by daboho; 02-25-2018 at 03:36 AM.

  55. #55
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    @ daboho - I don't see how your code can work both x and x1 are 2D arrays so y would be a 4d array

  56. #56
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,256

    Re: xladept Script Adjustment - Combining Two Sheets

    hehe thank before
    "ThankyouFor Attention * And Your Help!!"

  57. #57
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Okay I just deleted the rest of my post because it was super confusing

    It seems like everything is working now with the new version. I removed the color coding portion because I needed multiple colors which I fixed that up on my own.


    Yay - you're awesome.
    Attached Files Attached Files
    Last edited by NewYears1978; 02-26-2018 at 11:20 AM.

  58. #58
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Let's hope that that does it - but, if not, let me know

  59. #59
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I think so - I've tested it multiple times - just gotta make some tweaks to my own part of the code now. You are my best friend. lol


    Definitely looks like it is working I have tested it a few times now Just trying to sort out my color issues and then it will be done - wooooo!
    Last edited by NewYears1978; 02-26-2018 at 01:25 PM.

  60. #60
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I just remembered why I was using the INDEX Match formulas instead of copying the whole row of data in the script... Because sometimes the data in the other columns changes, but with the script it will not update those lines if the SO already exist in Column M it just leaves the other data.

    One column has ETA dates, which change on occasion....doh...!

  61. #61
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Hey xl - so sorry to bother you AGAIN (sent some PM about it). I am trying to repurpose the vode for ANOTHER form. This one is simple, I am simple Copying Column A through R and using A as the match column (to filter). There are some cells with blanks I don't know if there is a way to correct that too (when it copies blanks it always inputs numbers)


    Heeeelp!
    Attached Files Attached Files
    Last edited by NewYears1978; 03-30-2018 at 11:03 AM.

  62. #62
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Maybe:

    Please Login or Register  to view this content.

  63. #63
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Pro skill.

  64. #64
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Thanks for the compliment and for the rep!

  65. #65
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Buddy I need you again! Some of my co workers have added more columns to the end (It used to end in Column W, but now they have X and Y columns, and some just have X column..) and when we update it deletes the data in those 2 new columns.

    I can't find which part of the code to edit to modify that bit. Help! =D

    Please Login or Register  to view this content.
    Last edited by NewYears1978; 07-18-2018 at 12:23 PM.

  66. #66
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Is this the correct version? If you look at post#62, we were only copying the first 18 columns ("R") - I forget why?

  67. #67
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    So many version now I can't even keep up...maybe this user has old version on accident

    That's the version I am using too though so I dunno if there was a reason I had to use that one or what..it's been too long. Everyone has been using form just fine all these months It keeps everything just fine up until column W

    Oh wait, I know why, that #62 is the same script we modified for a different form I have...the Back Order form. One in question here is the Custom list form. I guess it could be modified also in the same way.

    So confusing since there are two diff scripts I use in two different forms (based on your original code)

    BackOrderCombineX and NewYearsCombine are the two diff ones. One working on here is the NewYearsCombine one I guess it would work here if I change the sheetnames though?
    Last edited by NewYears1978; 07-18-2018 at 12:49 PM.

  68. #68
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Try:

    Please Login or Register  to view this content.

  69. #69
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Brilliant.

  70. #70
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Glad it worked! Thanks for the compliment and for the rep!

  71. #71
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Hey xl, (or anyone else) - long time no chat on this one. I've run into an issue I can't decipher

    Please Login or Register  to view this content.
    This code works great however, something I never thought of before that was solved with VLOOKUPS before this non VLOOKUP code. If the line already exists, it ignores that line, the problem is there is one column with dates that change, and we need those to change.

    I guess I could change that one column to VLOOKUPS but that is messy. Any other solution you can think of?

  72. #72
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Can you post a new sample?

  73. #73
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I took the names out for security The colum in question is the one that says Next PO date, that date changes but since we're only matchin by the first column it ignores it.
    Attached Files Attached Files

  74. #74
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Try this:

    Please Login or Register  to view this content.

  75. #75
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Why u so awesome man? Thanks

  76. #76
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    You're welcome and thanks for the rep!

  77. #77
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Hey xladept, been a long time! Wondering if you could help me once again =D

    You helped me create those awesome macros for my sheets awhile back and I wanted to change a feature. Right now if you recall it combines to tabs in the sheet and removes data not found in the second sheet anymore (basically it updates the main tab with info from the second)

    Some coworkers asked if there was a way to make it move the "deleted" ones to a new sheet when it removes them as sort of an archive? So it would match them like always but copy those over to another sheet before removing them.

    This is the macro in question.
    Please Login or Register  to view this content.
    Thanks man, hope you and family are safe during this corono junk!

  78. #78
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    I see that you commented out the last 9 lines - see if this runs - it's just a quickie

    Please Login or Register  to view this content.
    Last edited by xladept; 04-09-2020 at 02:19 PM. Reason: Clear Archive Sheet

  79. #79
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Yeah I use the colors in some forms and not others, not in this one

    It works but it's missing a row for some reason (I test just by adding three fake rows with fake data, then update and run macro and it is only taking 2 of the rows i added, it's leaving the 3rd row in the sheet for some reason)
    Last edited by NewYears1978; 04-09-2020 at 05:54 PM.

  80. #80
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    Thanks for the rep! If it's not reading all the rows it's not working. Can you post an example that does that?

  81. #81
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Yeah see two files here.

    Main one then the other is the one you use when you update (click update macro and select the other file called Manifest)

    Thanks man I love you!
    Attached Files Attached Files

  82. #82
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    I'm rather fond of you too!

    See if this works:

    Please Login or Register  to view this content.

  83. #83
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Did this work for you? For me it went completely bonkers lol

  84. #84
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    I followed your instructions with the modified code and it worked??

  85. #85
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    Did you add in some dummy rows to test it? I added in 3 or 4 dummy rows (just copied the row above it but changed Column A since it is the matching column..and it didn't.

    The first time I ran it worked but after that it would not...weird?

    Let me test it naturally for a couple days waiting for some actual data to not be on the list and I will see if it works =D thanks buddy!
    Last edited by NewYears1978; 04-13-2020 at 10:43 AM.

  86. #86
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: xladept Script Adjustment - Combining Two Sheets

    When I ran it there were already 4 dummy rows and it put every one on the deleted sheet

  87. #87
    Forum Contributor NewYears1978's Avatar
    Join Date
    03-15-2010
    Location
    Forney, TX
    MS-Off Ver
    Excel 2016
    Posts
    962

    Re: xladept Script Adjustment - Combining Two Sheets

    I tried it again today and no bueno..doens't work and it is putting a date in the header column of the deleted sheet so something def going wonky.

    It works one time (sorta) but puts a date in the column a header for some reason..and then it won't work after the first time.
    Last edited by NewYears1978; 04-14-2020 at 12:02 PM.

+ 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. [SOLVED] small adjustment of my script
    By incobart in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 03-30-2017, 02:13 PM
  2. Combining information VB script
    By murrayjl03 in forum Excel General
    Replies: 3
    Last Post: 08-09-2016, 01:17 PM
  3. Small adjustment to add specific cell from multiple sheets?
    By garyi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-05-2011, 11:56 AM
  4. [SOLVED] Combining a Macro and Script
    By Donga00 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2011, 12:38 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