+ Reply to Thread
Results 1 to 15 of 15

Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

  1. #1
    Registered User
    Join Date
    08-26-2014
    Location
    Riyadh
    MS-Off Ver
    MS Office 365
    Posts
    24

    Post Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Dear All

    I have a file containing two sheets. On sheet 2 a specific cell contains a variable value. I want to lookup this value in a specific columns in another sheet and if the value is found then it copy and paste all the rows containing that value. Can somebody help me with that?

  2. #2
    Registered User
    Join Date
    08-26-2014
    Location
    Riyadh
    MS-Off Ver
    MS Office 365
    Posts
    24

    Unhappy Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Not a single respond so far

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    What are the sheet names? Which cell in sheet2 contains the variable value? In which columns in the other sheet do you want to search for the value? Where do you want to paste all the found rows?
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Registered User
    Join Date
    08-26-2014
    Location
    Riyadh
    MS-Off Ver
    MS Office 365
    Posts
    24

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Thanks Mumps for the response.
    There are two sheets Consolidated_RC and Data
    Cell B4 contain the value which I want to lookup in the Sheet Consolidated_RC Column C
    Once it find the value I want to copy all the rows containing that values into a range B9:K

    Your help would be highly appreciated.

    Thanks

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Range B9:K in which sheet, Consolidated_RC or Data? Do you want to copy the entirerow or just from column B to K?

  6. #6
    Registered User
    Join Date
    08-26-2014
    Location
    Riyadh
    MS-Off Ver
    MS Office 365
    Posts
    24

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    In Data sheet

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    This macro assumes that the Consolidated_RC sheet has headers in row 1 and the data starts at row 2.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-26-2014
    Location
    Riyadh
    MS-Off Ver
    MS Office 365
    Posts
    24

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Thanks a lot Mumps, it works as I desired just I want the data to be copied in the Data sheet values only without any formatting.

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Try:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-26-2014
    Location
    Riyadh
    MS-Off Ver
    MS Office 365
    Posts
    24

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Last week you have helped me by writing a code for me. The code works great. But I want to make a minor change. Some of the rows and columns in the the sheet CONSOLIDATED_RC I want to protect. (The sheet is protected). When I run the Macro gives me error:
    Run-time error '1004'
    Unable to set the autoFilterMode Property of the worksheet class.


    The protection does not allow the macro to remove the filter. Can you please modify the code to the perform the action on the protected Consolidated_RC sheet. The code is given as under:
    Please Login or Register  to view this content.
    Thanks in Advance.

    Khalid
    Last edited by Khalid.Noor; 04-11-2018 at 02:04 PM.

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    This macro assumes that the sheet is protected without a password. If you have used a password, please let me know and I will modify the macro.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    08-26-2014
    Location
    Riyadh
    MS-Off Ver
    MS Office 365
    Posts
    24

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    The password I've set is #09436

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    08-26-2014
    Location
    Riyadh
    MS-Off Ver
    MS Office 365
    Posts
    24

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    Thanks Mumps, you are amazing. Thanks alot.

  15. #15
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Macro to lookup a value in a Sheet and find that value in another sheet and Copy paste

    My pleasure.

+ 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 to find data in Sheet 2 copy and paste back in Sheet 1
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2014, 09:39 PM
  2. Macro to find numbers in column and copy/paste to other sheet
    By maxbeard in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2013, 11:28 AM
  3. [SOLVED] Excel Macro to lookup sheet name with a range of cells and paste in the reference sheet
    By mishaq in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-08-2013, 02:55 PM
  4. [SOLVED] Need help with macro that will FIND, COPY & PAste to different sheet :)
    By MeloReese in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-13-2012, 08:03 AM
  5. VBA macro to Find a dynamic range of cells, copy then paste to another sheet
    By Bmxerdude2087 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-24-2012, 02:36 PM
  6. Find Adjacent Data In One Sheet and Copy/Paste Into Other Sheet
    By jaylotheman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2011, 07:19 PM
  7. Find value from sheet 1, cell A1 in sheet(s) 2 (3, 4?), copy, paste row to sheet 8
    By fleeting in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2011, 03:31 PM

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