+ Reply to Thread
Results 1 to 4 of 4

copy from variable field location to variable field location

  1. #1
    Registered User
    Join Date
    03-22-2011
    Location
    Austin, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    copy from variable field location to variable field location

    Hello, and Hello again to everyone.

    I was wondering if anyone could help me with a little project I have going on.
    I'm trying to copy date paid and check numbers from book1 to book2 that have matching invoice numbers.
    My first problem is that my first invoice field location is variable, after that it progresses sequentially.
    The second is that the row of my target fields is also variable.

    Rather than explain I thought it would be better to list out my steps and include a dummy file. The field locations I've listed below are just examples and do not always remain the same unless listed as static.
    Copy first (Invoice) field from book1 location(5,C)(variable, variable)
    Switch Focus to book2
    CTRL+F
    Paste (Invoice 5C) into find field
    Press Find
    Invoice number is found at field location (78J)(Variable,Static)
    Switch Focus To book 1
    Copy (date paid) and (check number) from fields (5,D) & (5,E)
    Switch Focus to book 2
    Paste (date paid) and (check number) into (78,N) and (78,O) (variable,static) (variable, static)
    Switch focus to book1
    Copy second (Invoice) field from book1 (6C)(first invoice field location + 1 row)
    Switch focus to book2
    Paste (Invoice6C) into find field
    Press Find
    Invoice number is found at field (34J)
    Switch Focus to book1
    Copy (date paid) and (check number) from fields (6D) & (6E)
    Switch focus to book2
    Paste (date paid) and (check number) into (34N) and (34O)
    Switch focus to book1
    Copy third (Invoice) field from book1 (7C)(first invoice field location +2 row)
    and so on........


    Repeat until out of Invoice numbers

    One final consideration, … From time to time there are invoice numbers from book1 that don't match to anything in book2. There are in fact matches but due to input error or other, I have to go back and manually find them. This is perfectly okay, but I want to make sure the macro doesn't fail out when it finds one that doesn't match, instead if it could just close the "we didn't find what you were looking for" dialog, shift focus back to book1 and highlight the invoice in book1 that it couldn't find in book2 and move on, that would be PERFECT!

    I'm sorry if any of this is confusing or if I'm not using correct terminology, I'm a total newbie when it comes to excel. I've added a dummy file as well in case that helps.

    Thanks so much in advance for any help.
    Attached Files Attached Files
    Last edited by justjamesjust; 03-26-2011 at 03:52 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: copy from variable field location to variable field location

    This macro will do it. Put the macro into the Master workbook and save as a macro-enabled workbook. The macro will prompt you to pick the Update file from your hard drive, it will open it and run the update.

    If all invoices are found, it will tell you so and close the Update workbook.
    If all invoices are not found, it will highlight the ones it did not find and leave the workbook open for review.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    03-22-2011
    Location
    Austin, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: copy from variable field location to variable field location

    Thank you sooooo much, and doubly so for such a quick reply!
    I believe in the free sharing of knowledge and skills and I love to give back in any way I can.
    This help is definitely being paid forward to a close friend in desperate need, but if you can think of any way I can help, let me know.

    You totally made my day,
    J

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: copy from variable field location to variable field location

    Glad to help, of course. You should peruse some new threads and look for questions you might be able to answer for another OP.

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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