+ Reply to Thread
Results 1 to 8 of 8

Copy & paste entire row to different sheet based on cell entry

  1. #1
    Registered User
    Join Date
    11-07-2012
    Location
    Midwest, US
    MS-Off Ver
    Excel 2010
    Posts
    26

    Copy & paste entire row to different sheet based on cell entry

    Hello,

    I have a sheet (Sheet1) with several hundred rows.
    Column A is part numbers, columns B - J contain data regarding the part number. Due to a request, I need to setup a second sheet (Sheet2) in which a user can type the part number into a cell, lets say A1, and the macro would search Sheet1 - column A for the part number and then copy & paste that part number's entire row onto Sheet2, row 3.

    Since a majority of cells contain hyperlinks a simple Vlookup won't work. And wrapping the Vlookup in the HYPERLINK function still doesn't retain the hyperlink.
    So my thought is to use a macro that will copy & paste rather than just displaying the cell's text. Maybe there is a easier way to handle this without the use of a macro, but I am lost.

    I appreciate anyone's help!

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Copy & paste entire row to different sheet based on cell entry

    This is a rather easy solution in VBA, however, if you post a sample worksheet with representative data, it will be easier to design the Macro.

    Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    12-04-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Copy & paste entire row to different sheet based on cell entry

    Put a shape on Sheet 2 with this macro assigned to it: MyWb.xlsm!'CopyRow Thisworkbook.worksheets("Sheet2").cells(1,1)'

    The name of your workbook needs to be 'MyWb'..... or change it in the line of code above.

    On Sheet 2, put a part # into A1.

    Click the shape and it'll call this sub:

    Please Login or Register  to view this content.
    Last edited by Ragnaros; 12-13-2013 at 03:15 PM.

  4. #4
    Registered User
    Join Date
    11-07-2012
    Location
    Midwest, US
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Copy & paste entire row to different sheet based on cell entry

    Hello,

    Alansidman - I attached a quick example of what I am needing. A working example would help out great, Thnx.

    Ragnaros - I tried your code, it wouldn't paste the row though. I will try again. I know enough VB to be dangerous so more than likely it was something I did incorrectly.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy & paste entire row to different sheet based on cell entry

    The search value is A9 and the code copies in to B9 and below.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-07-2012
    Location
    Midwest, US
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Copy & paste entire row to different sheet based on cell entry

    It doesn't seem to work.
    When I start typing into A9 it moves my cursor immediately to B9.

  7. #7
    Registered User
    Join Date
    12-04-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Copy & paste entire row to different sheet based on cell entry

    Both of the solutions work. Expecially mine. :p

    You really need to go through a VBA tutorial and learn a little bit more on your own.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy & paste entire row to different sheet based on cell entry

    When I start typing into A9 it moves my cursor immediately to B9.
    Which code are you referring to?
    I have now added a button. When You enter a value in A9, the code first clears the existing data and repopulate the new data.
    To prove the code works, I have change the value of some of the columns and see the result.
    Attached Files Attached Files

+ 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] copy paste entire row into a specific cell in sheet 2
    By melody10 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-29-2013, 04:40 PM
  2. copy and paste excel rows based on cell entry
    By camileigh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-16-2013, 12:05 PM
  3. Copy and Paste into new worksheet based on entry on Sheet 1
    By alextwre in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2013, 06:10 PM
  4. Copy and Paste entire row based upon parts of value in a cell
    By queenstarks in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2013, 11:05 AM
  5. [SOLVED] Copy entire row to appropriate sheet based on value of cell in row E
    By engineerjason in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 11-12-2012, 07:48 PM

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