+ Reply to Thread
Results 1 to 6 of 6

Conditional Copying

  1. #1
    Registered User
    Join Date
    02-15-2010
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    76

    Conditional Copying

    A Happy 20011 to one and all.

    I was wondering if someone could assist me? I have cheekily copied someone's code to achieve what I want, however it doesn't quite do what I require. Basically I have a spreadsheet which I want only those rows which fall under a certain condition to be copied into a new sheet. For example if I have data populated in columns A, B & C, where C contains number reanging from 1 to 10; I would like to copy all data where the number in column C ranges from 3 and above. The code below copies everything that I need but I have to specify the number I want displayed. Is there a way (for example) I can amend the code to select all numbers greater than 3 and above? currently the code will display only those rows where column C is equal to 0?

    I have attached my test spreadsheet for ease of understanding.

    Apologies for any confision and thank you all in advance.

    Cheers
    Ivor

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Ivor; 01-09-2011 at 06:03 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Conditional Copying

    Try this which uses a different approach

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-15-2010
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    76

    Re: Conditional Copying

    Good evening Martin (MRice)

    Well all I can say is WOW. You have not only solved my issue but simplified the code for me. This will make it easier for me to replicate this on many other sheets even if they have more columns to filter.

    Thank you so much as you have just made my Mondasy morning back in the office a lot less stressful.

    Thank you again sir

    Enjoy the rest of your Sunday

    Cheers
    Ivor

  4. #4
    Registered User
    Join Date
    02-15-2010
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    76

    Re: Conditional Copying

    Quote Originally Posted by mrice View Post
    Try this which uses a different approach

    Please Login or Register  to view this content.
    Hello Martin

    Hope you have managed to find this message.

    Ok hopefully I won't confuse you with my ignorance, and I must pre warn you that I have taken the long way around modifying your code, as I am a complete novice.

    The attached spreadhseet contains the data I require modifying. Basically, in 6 individual columns (E,J,P,U,AA & AF,) I have the numbers ranging from 1 to 12 (which relates to the data in the rows to the left of the numbers). When I place a '3' in your code and run it, a new sheet is created listing the data that I want (i.e. showing everything from 3 and upwards.....to 12); I do not require the columns titled "Hub Status Code" to appear in the new sheet, so I modified your code to only capture the columns that I need (A to D, F to I .....so on). However whilst this works very well the data looks awfully messy and has a lot of gaps.

    Therefore what I am trying to do (painfully) is to make the first attachment (Stats) look like the second attachment (Stats result). I am almost there but am having to use multiple macros on each new sheet to get what I want.

    I hope this makes sense and I apologise for refering you to two different sheets, just that this is the easiest way to explain what I want without too much waffle. I have also copied below my modification to your code.

    Thanks again sir

    Hopefully speak soon

    Cheers
    Ivor

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Conditional Copying

    The examples helped a lot.

    Can you try the following...

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-15-2010
    Location
    Bournemouth
    MS-Off Ver
    Excel 2003
    Posts
    76

    Smile Re: Conditional Copying

    Quote Originally Posted by mrice View Post
    The examples helped a lot.

    Can you try the following...

    Please Login or Register  to view this content.
    Hello Martin

    nothing more I can say except of how grateful I am for your help. Your new code does exactly what I require, apart from formatting the final result into a pretty page as the source data but I have created a additional macro to deal with that which works perfectly.

    I have a couple of issues to work on next with the sheet, but I can deal with those in a new post/thread as I have already utilised all of my free help from your good self.

    I have given a small donation to your Marathon run, and wish you all of the best with that....I know four other people who have entered and I wish I could join them...but for the fact that I am not very good at running ha ha ha.

    Anyway thank you again for your help and maybe our paths will cross on the forum again (maybe in a day or two with my new thread )

    Take it easy

    Cheers
    Ivor

+ 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