+ Reply to Thread
Results 1 to 8 of 8

I want to extract the rows when a column met criteria

  1. #1
    Registered User
    Join Date
    08-02-2012
    Location
    Kuala Lumpur,Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    5

    I want to extract the rows when a column met criteria

    Hi Everyone,

    I need assistance on how to extract rows from sheet1 to sheet2 when a criteria met in a specific column. Example: if column B value >=(more than) 75% then the row that having the value will be copied and paste to another worksheet.

  2. #2
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: I want to extract the rows when a column met criteria

    wantaku11,

    Here is a macro that will do what you want. All you need to change is the Sheet Names that you are copying and pasting to.

    Please Login or Register  to view this content.
    In line 4 "If Cells(r, 2) >= 0.75 Then" this is stating that any value in column B "Cells(r,2)" with the number two meaning B because it is the second column that are >= to 0.75 or 75% will be cut and pasted to "Sheet2".
    Please Login or Register  to view this content.
    So all of the areas that contain either "Sheet1" or "Sheet2" need to be replaced by the sheet you want to copy from to the sheet you wish to paste in.

    The sections below the first "Next r" will look for blanks in column B on both sheets and delete those rows.

    I hope this helps!


    Simeon
    Last edited by simeon.hruby; 11-12-2012 at 04:03 AM.

  3. #3
    Registered User
    Join Date
    08-02-2012
    Location
    Kuala Lumpur,Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: I want to extract the rows when a column met criteria

    Hi Simeon,

    Thanks ... It works.

    I've been cracking my head how to do it ...

    But Thanks to you I manage to cool my brain ...

    Can I ask you one more question to complete the whole package,

    If i want to fill the row (from column A to column B only) how can i do it?

    Let say between 75% and 89% is orange
    between 90% and 99% is blue
    100% and above is red.

    The fill only happen before the transfer of the row to another sheets.

    hope you can helpe me out.

    Cheers

  4. #4
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: I want to extract the rows when a column met criteria

    wantaku11,

    Sure. You could use.

    Please Login or Register  to view this content.
    I hope this is what you were asking for!


    Simeon

  5. #5
    Registered User
    Join Date
    08-02-2012
    Location
    Kuala Lumpur,Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: I want to extract the rows when a column met criteria

    Hi Simeon,

    thank you again. I manage to edit the code accordingly.

    Just want to ask you the meaning of this code;

    For r = Cells(Rows.Count, 2).End(xlUp).Row To 1 Step -1

    Previosly I always used For r = 1 to 200

    What is the difference between both code ?

    because i hope in the future my macro language will be clever than current one.

  6. #6
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: I want to extract the rows when a column met criteria

    I use that line so that the macro starts at the bottom of the data and then works it's way up. This way it doesn't matter how many rows of data you have because it is not in any fixed selection.


    Simeon

  7. #7
    Registered User
    Join Date
    08-02-2012
    Location
    Kuala Lumpur,Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: I want to extract the rows when a column met criteria

    Simeon,

    thank you so much ... i managed to edit the macro according to my original specs.

    and i kind of understand how your counting works...maybe i should use that style more often ... at least the code do the counting according to available rows...

    With this i think i consider everything is solved ... i'm glad to have you to assist me ...

    Cheers
    Simeon.

    p/s:- in future if i need some help ... is it ok for me to contact u instead in the forum ? ^_^

  8. #8
    Forum Contributor
    Join Date
    10-31-2012
    Location
    Maryland, USA
    MS-Off Ver
    Excel 2003/2007
    Posts
    145

    Re: I want to extract the rows when a column met criteria

    I am glad I could help!

    Please feel free to contact me anytime!


    Simeon
    Don't forget to click the star in this post!

+ 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