+ Reply to Thread
Results 1 to 16 of 16

Copying highlighted cells to another cell

  1. #1
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Copying highlighted cells to another cell

    Hello All,

    first off I really am imprssed by the great effort in the forum ...


    I made a macro that uses conditional formatting to highlight duplicates,triplicates, etc .
    now I want the macro to look for the now-highlighted (red) -duplicate- cells and put them in AA column and remove the duplicates from the AA column ...and look for triplicate (Yellow) cells and put them in AC...the thing is I can`t get it to copy the highlighted values to the specified columns....here is the code I have so far

    Please Login or Register  to view this content.
    Thanks in advance
    Last edited by MasterN; 06-30-2010 at 08:19 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copying highlighted cells to another cell

    Hi MasterN,
    Welcome to the forum.
    You cant select condital format cells by colour.
    You will have to select the cells with the condition formula and the cells value
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copying highlighted cells to another cell

    Quote Originally Posted by pike View Post
    Hi MasterN,
    Welcome to the forum.
    You cant select condital format cells by colour.
    You will have to select the cells with the condition formula and the cells value
    Thank you Pike for the quick reply .

    well .. the cell values are variable .. the data are fed to excel through another program .. so everytime Excel is opened the data is changed .. so I can`t select the cells with their values .. how can I select the cells with the condition formula ?!

    EDIT: something came to my mind ... is the problem with color ?! .. should I get the condition formula to change something else in the cell in the first place ?! if so , what should be changed !!
    Last edited by MasterN; 06-27-2010 at 08:22 AM.

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copying highlighted cells to another cell

    No, the conditional format cell colour is different to the cell.interior.color, which you can select cells by

  5. #5
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copying highlighted cells to another cell

    Quote Originally Posted by pike View Post
    No, the conditional format cell colour is different to the cell.interior.color, which you can select cells by
    I got what you mean .. is there a way to get Conditional Format through VBA to change the Cell.Interior.Color ?! ..

    I tried experimenting with
    Please Login or Register  to view this content.
    in the If statement .. but still I can`t get it to work

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copying highlighted cells to another cell

    you could use a find synatx
    the first find to AA
    run the find again these go to AC

  7. #7
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copying highlighted cells to another cell

    Quote Originally Posted by pike View Post
    you could use a find synatx
    the first find to AA
    run the find again these go to AC
    What should the find syntax look for ? .. and then what would the implementation of the loop be like ?

  8. #8
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copying highlighted cells to another cell

    Ok ... I almost solved it ...here is what I came up with so far ...as my code highly depend on conditional formatting ...I thought then I should change the conditional format highlight into the cell.interior color ...this function change the FormatConditions.Interior.Color into Cell.Interior.Color

    Please Login or Register  to view this content.
    I then applied a for loop .. to get the resulting cells into a column

    Please Login or Register  to view this content.
    The bad thing is ..well actually two bad things .. ... first off .. it takes almost 4 minutes to finish and it freezes Excel during calculating the Macro ... the second thins is that I got the results scattered around in almost 12 columns .. every other column .. instead of ONE column as I intended for it to do . I can`t tell what is wrong with the for loop ..

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copying highlighted cells to another cell

    MasterN
    try this code it may be faster
    Please Login or Register  to view this content.
    Last edited by pike; 06-28-2010 at 04:06 AM. Reason: correct number of collection

  10. #10
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copying highlighted cells to another cell

    I think I reached a point that I need a fresh eyes to look at the code as I can`t figure out why the code does what it does ... here is what I`ve done so far ..

    1- the code applies three formulas of Conditional Formatting . ( check)
    2- then look for cells with that conditional Format applied to .. and convert the FormatConditions.Interior.Color into cell.Interior.Color . (check)
    3- Delete the Conitional Formatting from the cells (check)
    4- look for cells with "red" color and put them in the column AA ( start of the problem here I guess )
    5- look for cells with "Yellow" color and put them in AC .( the code doesn`t do this step at all)
    6- look for cells with "green" color and put them in AE
    7- delete duplicates from column AA .
    8- delete Duplicates from Column AC
    9- delete Duplicated from column AE


    I attached the sheet with the macro in it .. hopefully someone will be able to spot what is wrong with the code .. thank you in advance

    here is the code as well

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by MasterN; 06-30-2010 at 04:04 AM.

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copying highlighted cells to another cell

    did you try the code?

  12. #12
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copying highlighted cells to another cell

    Quote Originally Posted by pike View Post
    did you try the code?
    I was waiting to solve the issue first as I didn`t want to add another problem while trying to figure out why it isn`t working the way it is supposed to .I was thinking get it to work right then worry about efficiency .. this thread was about the highlighting issue and I believe it is solved ( I just wrote another thread to keep it in particular and mark this thread solved ..I was wondering how to do so though )
    Last edited by MasterN; 06-30-2010 at 03:44 AM.

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copying highlighted cells to another cell

    Hi MasterN,
    You can't copy conditionally formated coloured cells.

  14. #14
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copying highlighted cells to another cell

    Quote Originally Posted by pike View Post
    Hi MasterN,
    You can't copy conditionally formated coloured cells.
    Hello Pike,

    the cells are no longer conditionally fomated .. the custom function ConditionalColor .. changes the Conditional Format coloured cells into a normally colored cell .. as I already mentioned in my previous post ... now the Cell.Interior.Color = FormatConditions.Interior.Color ... I tested it and it works ( please check the function in the previous post )... the problem isn`t in the conditional format anymore .. this is why I mentioned that I want to mark this thread as solved ...

  15. #15
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Copying highlighted cells to another cell

    Hi MasterN,
    Appoligises,I didnt read that ,very very good idea. I have to subscribe to the other thread .

  16. #16
    Registered User
    Join Date
    06-27-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Copying highlighted cells to another cell

    Thank you, Pike ..

    here is the link to the other thread hopefully you can help with it .. I tried to explain the code the best I can .. so someone would be able to go through it and help get it over with

    http://www.excelforum.com/excel-prog...al-format.html

+ 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