+ Reply to Thread
Results 1 to 6 of 6

VBA code to copy from another workbook using multiple cell values

  1. #1
    Registered User
    Join Date
    03-27-2012
    Location
    Crawley
    MS-Off Ver
    Excel 2010
    Posts
    27

    VBA code to copy from another workbook using multiple cell values

    Hi all,

    I have this code which searches for the value in F6 in another workbook and returns the relevant row from that workbook.

    This might be an elementary question, but say I want to add another criteria , ie, I want the user to enter a value into cell F6 and, for example, F7, what changes would I need to make for this to happen?

    It needs to be done as just searching by F6 doesn't differentiate between duplicates, and I need the user to also enter a name, again for example, in F7 to locate the exact row required.

    Thanks.

    Please Login or Register  to view this content.

  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: VBA code to copy from another workbook using multiple cell values

    Value F6 is being matched to column D, F7 is matched to column ??
    _________________
    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-27-2012
    Location
    Crawley
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: VBA code to copy from another workbook using multiple cell values

    Hi,

    Knew I'd forgotten something important...

    F7 would match with Column F

    Thanks,

  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: VBA code to copy from another workbook using multiple cell values

    Assuming the name is column A, something like this:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-27-2012
    Location
    Crawley
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: VBA code to copy from another workbook using multiple cell values

    That works perfectly, thankyou.

    The one thing that I may need to change, it now comes up with the message box about there being a large amount of data on the clipboard and do I want to keep it (after pasting into sh1).

    How do I set this to automatically say no?

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

    Re: VBA code to copy from another workbook using multiple cell values

    Application messages like tht can be suppressed by adding this near the top of your macro:

    Please Login or Register  to view this content.

    If that takes care of your need, please select Thread Tools from menu above and set this topic to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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