+ Reply to Thread
Results 1 to 7 of 7

copy and paste based on cell value / text

  1. #1
    Registered User
    Join Date
    03-06-2010
    Location
    essex, england
    MS-Off Ver
    Excel 2003
    Posts
    23

    copy and paste based on cell value / text

    Hi all,
    Im having trouble writing code for copying and pasting information from one sheet to another based on a cell value

    lets say i have sheet a and b
    sheet a has the data and sheet b is where to run the macro from
    i want to be able to type a number in sheet b say cell b3 and search for that number on sheet a and copy the relevant info and paste it on sheet b

    i have uploaded a sample sheet with comments it will proberly explain it better

    i didnt even know where to start with this so there is no macros in the sheet at the mo

    any help would be greatly received

    thanks
    Attached Files Attached Files

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: copy and paste based on cell value / text

    Hi,
    any particular reason you want to do this with a macro instead of a formula?

    You could simply use Vlookup

    =VLOOKUP(B3,data!$B$3:$F$14,2,FALSE)

  3. #3
    Registered User
    Join Date
    03-06-2010
    Location
    essex, england
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: copy and paste based on cell value / text

    Hi there,
    thanks for your reply but thats not what i need, sorry my fault im bad at explaining
    ok so here goes i want to put a number in cell b3 on the report tab, push a button and the macro will search colum A on the data tab and if it finds a match it will copy all the data to the right of it onto the report tab in the green area, if it doesnt find a match msg box with number doesnt exsit or something along them lines

    please help

  4. #4
    Registered User
    Join Date
    03-06-2010
    Location
    essex, england
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: copy and paste based on cell value / text

    ok ive found some code which is kinda what i need

    Please Login or Register  to view this content.
    heres what it does:
    you click the button on sheet2........an input box is shown..............you type in a number of text to search for..............it searches sheet1 colum a for a match...............if a match is found it copys the row from sheet1 to sheet2 in the next avaliable row.

    heres what i need:
    click the button on sheet2 (report tab)..............macro will search colum a sheet1 (data tab) for the number or text that i typed in sheet2 (report) in cell b3..............if a match i found it will copy the data to the right of the matching number onto sheet2 in the green area shown
    the data copied from sheet1 will always be colums b to f but the amount of rows differs.

    please see attached sheet in the first post it will be easier to see what i want from that

    thanks
    Last edited by '''your code here; 03-14-2010 at 05:55 PM.

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: copy and paste based on cell value / text

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  6. #6
    Registered User
    Join Date
    03-06-2010
    Location
    essex, england
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: copy and paste based on cell value / text

    It seems that this post is comming to a dead end is there anyone that can help me
    im desperate

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: copy and paste based on cell value / text

    I think nobody really knows what your question is.

+ 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