+ Reply to Thread
Results 1 to 9 of 9

Copy specific range from sheet to another if condition in cell met

  1. #1
    Registered User
    Join Date
    01-28-2012
    Location
    Pune, India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Exclamation Copy specific range from sheet to another if condition in cell met

    Hello Guys..I am new to this forum and have seen a lot of VBA questions answered here. I would like an answer to one of my own issues.

    I have attached a sample excel sheet with certain formulas for specific columns.
    Following is my basic requirement : I want to copy a specific range, instead of complete row and paste it into another sheet if a condition is met in column.
    In this forum I only found examples of copying a row and pasting into another sheet.

    For example, in the workbook provided, "JAN-12" sheet has the data with formula in H column.
    "DELIVERY" sheet has corresponding columns with last 2 columns having formula in them.

    When I use the
    Please Login or Register  to view this content.
    it will copy the entire row and paste entrie row too as per paste code
    Please Login or Register  to view this content.
    But this will remove any formulas that I have set in the last 2 columns and also paste "Rejection details" columns from Jan-12 sheet to Delivery sheet.

    Kindly help with a macro code that will copy only the first 10 columns to another sheets for the corresponding cell in which criteria is met.

    *criteria : If "Status" column has "C" then data from first 10 columns in that row should be copied to "Delivery" sheet.

    Hope this makes sense...open to any queries.
    Attached Files Attached Files

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Copy specific range from sheet to another if condition in cell met

    How about,

    Please Login or Register  to view this content.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Registered User
    Join Date
    01-28-2012
    Location
    Pune, India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Copy specific range from sheet to another if condition in cell met

    I am not worried about the paste format...

    I am looking for copying specific range from one sheet to specific range on another sheet.


    **also need clarification on following

    Please Login or Register  to view this content.
    In above code, paste operation is performed but formula is pasted and not the result, which is needed.

  4. #4
    Registered User
    Join Date
    12-04-2011
    Location
    Poland
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Copy specific range from sheet to another if condition in cell met

    Try the sheet attached (created in Excel 2010, but hope it will work with 2007)
    activex command buttons should transfer required data, you will need to adjust code
    Regards
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-28-2012
    Location
    Pune, India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Copy specific range from sheet to another if condition in cell met

    WOW!!...that worked great
    Last edited by Zagadka; 01-28-2012 at 11:09 AM.

  6. #6
    Registered User
    Join Date
    01-28-2012
    Location
    Pune, India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Thumbs up Re: Copy specific range from sheet to another if condition in cell met

    WOW!! ...amazing how your mind works...never thought of implementing autofilter..

    mardyl :: Thanks a ton for the quick reply...saved me hours of research time (..though i wasted a lot of time on it already..)

    Anyways...addition to it, can we keep the original color, font, alignment to the copied data in delivery sheet?

  7. #7
    Registered User
    Join Date
    12-04-2011
    Location
    Poland
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Copy specific range from sheet to another if condition in cell met

    At present the code under yellow button copies values only, try to change it


    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-04-2011
    Location
    Poland
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Copy specific range from sheet to another if condition in cell met

    If you found it helpful please add a point to my reputation by clicking small asterix in bottom left corner of my post

  9. #9
    Registered User
    Join Date
    01-28-2012
    Location
    Pune, India
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Copy specific range from sheet to another if condition in cell met

    Thanks again for the quick resolution...works like a charm...


    Reputation already given...

+ 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