+ Reply to Thread
Results 1 to 26 of 26

Check cells for color index and delete

  1. #1
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118

    Check cells for color index and delete

    I am trying to write some code and I am lost.

    Column Y-has Y, N entered in cells
    Column R-has 1,2, etc... entered in cells (some cells have color index 26)
    Column O-has 1, 2, etc... entered in cells (some cells have color index 3)
    Column G-has names entered entered in cells (some cells have color index 38)

    I need the macro to check if Column Y has a "N" and then if it does check Column R, O, G and if there is no color index in any of the Columns the macro will delete the row.

    If Column Y has a "N" but Column R, O, G has a color index it will not delete the row.

    There are 3000 rows on the spreadsheet and the macro would need to go through all the rows.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    How is the colorindex set? If it is by a conditional format, it makes a difference.

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    randolphoralph,

    Please read forum rules below about duplicate posts. You appear to have asked this question 3 times now

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    This is acutally a different post.

    Column R-has 1,2, etc... entered in cells (some cells have color index 26) Conditional Format
    Column O-has 1, 2, etc... entered in cells (some cells have color index 3) Color Set By Format
    Column G-has names entered entered in cells (some cells have color index 38) Conditional Format
    Last edited by randolphoralph; 07-25-2008 at 04:52 PM.

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    You will need to install the routines on Chip's site.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    I went to Chip's site and looked for routines to install. I could not find anything. Am I missing something?

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    randolphoralph,

    This thread will be closed unless you add the link to the cross post

    VBA Noob

  8. #8
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    I would be glad to add this link to the cross post. How do I add it?

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    If you had read the forum rules below you would know how.


    VBA Noob

  10. #10
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    Below are the links to the cross posts.

    http://www.techsupportforum.com/micr...ml#post1611860

    http://www.oooforum.org/forum/viewto...=292912#292912

    http://www.xtremevbtalk.com/showthre...86#post1298786

    http://excelusergroup.org/forums/p/805/2494.aspx#2494

    http://www.andreavb.com/forum/viewto...ID=8275&page=0

    http://forums.devx.com/showthread.ph...995#post507995

    I have posted this question many places because I have been working on this code for several weeks and have had no luck in getting the code to do what I need. Everyone points me to Chip's site but I am not sure what I am missing. I do appreciate everyone that has taken the time to help with this.

  11. #11
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    Kenneth-

    I have gone to Chip's website. I have added the Function ActiveCondition, Function ColorIndexOfCF, Function ColorOfCF, Function GetStrippedValue, Function CountOfCF, and the Function SumByCFColorIndex. I added these functions above the code that you provided. Do I need all of these functions? Do I need to edit these functions to work with my data?

  12. #12
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    Here is an example xls with Chip's routines and the one that I posted.

    ColorIndexOfCF requires the ActiveCondition. I just put them all in a separate module.
    Attached Files Attached Files

  13. #13
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    randolphoralph, Perhaps it would have been easier to provide a sample workbook!


    randolphoralph, crossposting on so many places can actually be detremental to you getting help, as you may have already guessed nearly every potential helper in all the forums visit all the forums, and as such don't take kindly to helping you in one forum only to find another has given up their valuable free time to work on the same solution!

    Please be considerate of those giving you free help in their free time!
    Not all forums are the same - seek and you shall find

  14. #14
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    Kenneth-

    I tried to use your sample on my spreadsheet with no avail. I have included my spreadsheet as suggested.

    Simon Lloyd-

    Thank you for the suggestion about being careful to not cross post. I am new to using forums and it did not even dawn on me that the same people would use the same forums. I am quickly learning and appreciate the heads up.

    Everyone here has been so helpful Thanks
    Attached Files Attached Files
    Last edited by randolphoralph; 07-27-2008 at 05:57 PM.

  15. #15
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    I misread your If. What you wanted was to delete the cells with no colorindex I think in any of the column rows G,O and R if Y column="N". So, in my routine change:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    Even so, I need to check a few other things. I will post back.
    Last edited by Kenneth Hobson; 07-27-2008 at 07:18 PM.

  16. #16
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    Ok I have updated that in the routine.

  17. #17
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    I am looking into Chip's routine more. From these tests, one can see that the conditional formula1 is returned as =AC2 rather than =Q2. Chip talked about the using absolute reference for the Formula Is routines but not for the Cell Value Is.

    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    I am glad to see that I am not the only one having issues with this. I was thinking that I was missing something because no matter what I was trying nothing was working.

  19. #19
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    I had an idea....What about having the macro replicate the same items that the conditional format conditions? Wouldn't this provide the same results that I am seeking and be a whole lot easier?

    Column R
    Highlighted Purple-If Column R is > or = Column Q

    Column G
    Highlighted Yellow-If Column U="N" & Column V="N" or V="" or V=" "

    Column O
    No Conditional Format Set
    Fill Color is set to Red-If Column O="1" and Column P has a date in the field

    I have included a updated example spreadsheet..All that was updated was that I included a date in the cell on Column P
    Attached Files Attached Files
    Last edited by randolphoralph; 07-28-2008 at 04:35 PM.

  20. #20
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    Yes, that would be easier and more reliable. It is easy to add a worksheet event. It can easily set the interior color for you based on a change event. Once the change events set the colors as needed, the delete routine would be similar to what I was using.

    I will look at this tonight if you like.

  21. #21
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    That would be greatly appreciated...Thank you so much for all your help.
    Last edited by randolphoralph; 07-28-2008 at 04:43 PM.

  22. #22
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    I added routines to strip conditional formatting, add interior colorindexes, worksheet change event and the code to delete the rows.

    http://www.mediafire.com/?ksyj03mxy95

  23. #23
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    Kenneth,

    It works great. I can not thank you enough this will save me about 2 hours each day. I can spend the time doing something more productive. You Rock!

  24. #24
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    If I wanted to add another Column (Column W) to check if there is a color in it. I know that I would need to update the routine with the extra column. I have added it and it still does not recognize it. I have added the code that I updated below and bolded what I added. What am I missing?

    Please Login or Register  to view this content.

  25. #25
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    That should work. Make sure that they have no conditional formats that override the colorindex.

  26. #26
    Forum Contributor
    Join Date
    07-24-2008
    Location
    San Antonio, Texas
    Posts
    118
    That conditional format will get you every time. Thanks

+ 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