+ Reply to Thread
Results 1 to 6 of 6

Macro to select non-contiguous union of cells based on values in other column

  1. #1
    Registered User
    Join Date
    09-07-2011
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Macro to select non-contiguous union of cells based on values in other column

    Dear Ladies and Gents,

    I would very much appreciate your advice on a VBA problem I am trying to solve:

    Data Given:
    _____________________________________________
    Column A | Column B

    64______|_____Y_____
    25______|_____N_____
    54______|_____Y_____
    15______|_____N_____
    54______|_____N_____
    34______|_____Y_____
    _____________________________________________

    Now, data in column A is derived by formula, for this problem does not matter by which one.

    I would like to create a macro that would select cells (as a non-contiguous union) in column A, but only those, where for corresponding rows in Column B you have 'Y'.

    Idea is that the second part of the macro would copy those selected cells and paste them as values, so that they are no longer formulas, but values instead. This way every line in A, that has 'N' or nothing in column B would still remain as a formula.

    Many thanks in advance.
    Michael

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Macro to select non-contiguous union of cells based on values in other column

    You may try this.....
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    09-07-2011
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Macro to select non-contiguous union of cells based on values in other column

    Hi sktneer,

    Thanks for your reply, but does not seem to be working yet..

    Regards,
    Michael

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Macro to select non-contiguous union of cells based on values in other column

    Please find the demo sheet and click on the Green Button on Sheet1 to see if this is not what you are trying to achieve.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-07-2011
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: Macro to select non-contiguous union of cells based on values in other column

    Many Thanks Sktneer!

    It was my lack of knowledge that prevented formula from working properly.

    Kind Regards,
    Michael

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Macro to select non-contiguous union of cells based on values in other column

    You're welcome. Glad I could help.

+ 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. Inputbox, Union and non-contiguous ranges
    By medwatt in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-10-2014, 12:12 PM
  2. [SOLVED] Copying (non-contiguous) headers to next sheet: errors with Union method
    By k64 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-29-2013, 12:07 PM
  3. [SOLVED] Union non-contiguous range
    By cokillerliu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2013, 10:38 AM
  4. [SOLVED] Macro to color groups of cells based on column values
    By juskojj in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2012, 10:53 AM
  5. Select last contiguous range of cells in a column (seached)
    By IconoclastDX in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2011, 07:59 PM

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