+ Reply to Thread
Results 1 to 5 of 5

Modify Code to change cell background color

  1. #1
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Modify Code to change cell background color

    Hello, I have the code below set to change the background color based on certain conditions. What I need to do is change it so that if none of the conditions are met, it does not change the color at all. As it is written now, if anything is entered in a cell that has a background already set, but does not meet these conditions, the cell turns white.

    Please Login or Register  to view this content.

    Thanks!
    Clayton Grove
    Last edited by VBA Noob; 11-12-2008 at 02:49 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Hi Clayton, try this code:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324
    That worked great thanks! I don't know if this is worthy of another thread, so if it is let me know. How can I change this line to find any sting of text with "SBP" in it. I tried "*SBP*" but it did not work?

    Please Login or Register  to view this content.
    Thanks!
    Clayton Grove

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    I think if you change your code to this it will work the way you need it. Unfortunately, Case statements don't have a Like or wildcard operator so you have to force it to perform other tests (which doesn't make it much more efficient than an If/ElseIf/Else/EndIf statement).
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324
    You're the man!

    Thanks.
    Clayton

+ 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