+ Reply to Thread
Results 1 to 8 of 8

Copy rows to new sheet, based on y/n value in 1st column

  1. #1
    Registered User
    Join Date
    05-08-2014
    MS-Off Ver
    Excel 2010
    Posts
    4

    Copy rows to new sheet, based on y/n value in 1st column

    Hi All,
    I'm pulling my hair out (partly cause my VBA skills are nill, and because I know this can be easily done).

    I have a single sheet that lists available items, prices, etc. When doing quotes, you simply put y/n in Col:A for each item. I then want a simple macro that will copy all of the rows with "yes" into a second sheet. Sample data with end result attached.

    I did try and butcher this macro to do what I want, and whilst it does copy data across, it's not really working. Firstly as I think it is searching along a row and copy columns, whereas I need to search a column and then copy rows.

    Please Login or Register  to view this content.
    Thanx in advance.
    sample_data.xls

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Copy rows to new sheet, based on y/n value in 1st column

    Using autofilter will be quicker than looping through I think:
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Copy rows to new sheet, based on y/n value in 1st column

    Try this attached file
    Attached Files Attached Files
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  4. #4
    Registered User
    Join Date
    05-08-2014
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Copy rows to new sheet, based on y/n value in 1st column

    Fantastic guys, thanx for the quick replies. I knew it fairly straight forward, for those who know!

    Will give it a go.

    Cheers,

  5. #5
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Copy rows to new sheet, based on y/n value in 1st column

    Glad we could help

    1. the Solution helps you, Click * to Add Reputation and leave ur comments
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  6. #6
    Registered User
    Join Date
    05-08-2014
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Copy rows to new sheet, based on y/n value in 1st column

    Ok, tested on a dataset......

    ragulduy - It filters the data, but doesn't seem to copy it. I have changed the "sheet" name to match my data..... Though, it did actually make me think and forehead slap myself. I could just apply a manual filter to column A!

    Naveed - This works great. Do have one question, my actual data has formulas in the cells. Could the macro copy the 'values' rather than the formulas?

    Cheers,

  7. #7
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Copy rows to new sheet, based on y/n value in 1st column

    Just replace value below code with that existing code

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-08-2014
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Copy rows to new sheet, based on y/n value in 1st column

    Fantastic.... Thanx Naveed!

+ 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 rows to new sheet based on value in Column 1
    By lzrdlvr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-12-2013, 09:15 AM
  2. Copy rows into new sheet based on cell/column data
    By StagemanGraham in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2012, 08:11 PM
  3. copy rows to new sheet based on column value..
    By wardga in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-29-2010, 07:44 AM
  4. [SOLVED] MACRO - copy rows based on value in column to another sheet
    By Michael A in forum Excel General
    Replies: 1
    Last Post: 03-04-2005, 11:06 PM
  5. [SOLVED] MACRO - copy rows based on value in column to another sheet
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2005, 09:06 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