+ Reply to Thread
Results 1 to 7 of 7

VBA Compare and Match

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Compare and Match

    Hi, I wonder whether someone may be able to help me please.

    I've put together a small script to perform the following:

    • Compare a list of staff names in columns B on the sheets "Flexible Resources List and "All Resources", and
    • Where a match is found,
    • Copy column H on the "Flexible Resources List" sheet and paste this into column H on the "All Resources" sheet.

    This is the code I've put together so far:

    Please Login or Register  to view this content.
    I'd now like to adapt this a little, but I'm a little unsure about how to go about it.

    I'd still like to copy and paste the data from, and to columns H on the respective sheets, but in addition, I'd now like to copy columns E, F and G from the "Flexible Resources List" and paste this to columns I, J, and K on the "All Resources" sheet.

    I'm just not sure how to join multiple columns, so I just wondered if someone may be able to look at this please and offer some guidance on how I may go about achieving this.

    Many thanks and kind regards

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: VBA Compare and Match

    I do not think your code does what you describe. You may try:
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Compare and Match

    Hi @Izandol, thank you for taking the time to reply to my post.

    It's interesting that you feel my code won't work. I must admit to receiving some help along the way, so I'm not 100% sure to the meaning of each line, but the code is working.

    I did try the code you kindly provided, but unfortunately I was unable to get this to work, and although I didn't receieve any error, the values were not paste into the destination sheet.

    You did however show me the right way to go about making the necessary changes.

    So I changed:

    Please Login or Register  to view this content.
    to:

    Please Login or Register  to view this content.
    and the script now works perfectly.

    Many thanks and kind regards

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: VBA Compare and Match

    I do not understand. Is that not the code that I provided? (I see no need for 0 + 3 rather than 3)

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Compare and Match

    Hi @Izandol, thank you for taking the time to come back to me with this.

    In bow down to your experience, but from the testing I did, I couldn't get this to work without the '0+3'.

    Perhaps I included a typo when copying your code across, I'm not too sure.

    Kind Regards

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: VBA Compare and Match

    There is no value difference between 0 + 3 and 3, and Offset requires a numeric value therefore I cannot see coercion as an issue here. I did not in fact understand why you had 0 + 1 originally in your code - from where did you get it?

  7. #7
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Compare and Match

    Hi @Izandol, I went back to look at the code, and I offer my apologies for the confusion and frustration, because your code works perfectly.

    I must have included a typo when I initially put together the script with your code.

    Once again, my apologies.

    All the best and kind regards

+ 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] VBA Compare & Match
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2013, 09:51 AM
  2. PLEASE HELP!! 2 Sheets Need to Compare & Match....
    By cre8tvlife in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-17-2013, 03:00 AM
  3. Replies: 6
    Last Post: 05-30-2012, 03:09 PM
  4. Compare 2 arrays using Match
    By skimmer333 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-07-2010, 03:38 AM
  5. Excel 2007 : question about compare and match
    By InfinitI in forum Excel General
    Replies: 5
    Last Post: 05-20-2009, 09:48 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