+ Reply to Thread
Results 1 to 3 of 3

VBA-Fill color based on multiple criteria

  1. #1
    Registered User
    Join Date
    05-31-2011
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2003
    Posts
    1

    VBA-Fill color based on multiple criteria

    I am a VBA novice. Using the basic color palette in Excel (note: my business still uses 2003), I want the fill color of a cell to change based on the name of the color input into the cell. For instance, if "red" is typed in A1, the fill color of A1 turns to red. If "yellow" is typed in B1, the fill color of B1 turns to yellow. In addition, other pages in my notebook will reference these cells with a simple equal function and those cells also need to change to the correct fill color.

    I have searched the internet for two days and cannot find an answer. Help would be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA-Fill color based on multiple criteria

    Conditional formatting makes it easy to do what you have described. Just set a rule where if a cell contains the text red, yellow, etc it fills with that corresponding color. A couple of rules may be neccessary but shouldn't take you too long. Then just set the range you want it to associate with.

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: VBA-Fill color based on multiple criteria

    Hi Kimmie, stnkynts is of course right but if you are bent on coding this you could do something like:
    Please Login or Register  to view this content.
    If there are more colours then you would have to code them in but once this is set up it will have no problem converting cell background colours.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

+ 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