+ Reply to Thread
Results 1 to 4 of 4

create a simple macro that changes fill color

Hybrid View

  1. #1
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Quote Originally Posted by Niclas
    Hi guys! Found this forum today, it looks good!

    It's been a while ago since I've been working with excel, and I forgot alot of things. I really need help creating a macro that changes the fill color of a cell depending on the value in another cell.

    I have 3 rows. 1 is ID number, could be anything. 2 is Value A and 3 is Value B.

    I have 4 ranges that I need to use.
    Range 1: AWAY (FILL WITH BLUE)
    Range 2: 0 to -99999 (FILL WITH RED)
    Range 3: 30 to 0 (FILL WITH YELLOW)
    Range 4: 30 to 99999 (FILL WITH GREEN)


    Range 1 is priority ONE and so on. So if VALUE A = 40 and VALUE B = -10, then the FILL COLOR inn ROW 1 = RED.



    Sorry for my bad english, but I'll hope you understand what I want. I attached a copy of my .xls.


    Regards,
    Niclas
    Hi,

    You don't really need a macro, you can use Conditional Formats to achieve what you want. Format the cell in the usual way as a default of Blue, then using the 'Formula is' option set the following conditional formats in A4 and copy down,

    First condition - Green
    =AND(A4>30,A4<=99999)
    Second condition - yellow
    =AND(A4>0,A4<=30)
    Third condition - Red
    =AND(A4<0,A4>-99999)
    If you really do want a macro solution then post back.

    HTH

  2. #2
    Registered User
    Join Date
    02-08-2008
    Posts
    2
    Thanks guys! Will try this out!

    Edit: Just what I was looking for! Thanks!
    Last edited by Niclas; 02-17-2008 at 05:54 PM. Reason: It worked!

+ 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