Results 1 to 6 of 6

How to fill range od cell with color depend of value

Threaded View

KertLopper How to fill range od cell... 03-01-2020, 03:54 PM
AlphaFrog Re: How to fill range od cell... 03-01-2020, 05:24 PM
KertLopper Re: How to fill range od cell... 03-01-2020, 05:40 PM
AlphaFrog Re: How to fill range od cell... 03-01-2020, 07:37 PM
KertLopper Re: How to fill range od cell... 03-02-2020, 05:37 AM
FlameRetired Re: How to fill range od cell... 03-01-2020, 07:30 PM
  1. #1
    Registered User
    Join Date
    03-01-2020
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    3

    How to fill range od cell with color depend of value

    I'm looking for solution how to fill range od cell with color depend of value.

    I've attached the file.

    There is special row 9.
    Value of the cell in the row 9 depend of value in the cell in row 6.

    For example:
    - if left cell in row 6 is empty the value of row 9 is 1.
    - if left cell in row 6 is the same the value of row 9 is the same like in the left cell
    - if left cell in row 6 is different the value of row 9 is the same like in the left cell +1


    I can cut and paste cells in row 6 and all with values in row 9 working fine.

    ok, and now if value in row 9 is > 0 I would like to fill row from 6 to 9 with color.



    I'd like to achieve something like this:
    - If value in row 9 is 1 then color in this column for row from 6 to 9 is blue
    - If value in row 9 is 2 then color in this column for row from 6 to 9 is red
    - If value in row 9 is 2 then color in this column for row from 6 to 9 is green
    ....


    For example (according to the file in attached):
    -if value D9 is 1 then D6-D9 is filled with blue
    -if value F9 is 1 then F6-F9 is filled with blue
    -if value G9 is 1 then G6-G9 is filled with blue
    -if value H9 is 2 then H6-H9 is filled with red
    -if value J9 is 1 then J6-J9 is filled with blue
    -if value K9 is 2 then K6-K9 is filled with red
    -if value L9 is 3 then L6-L9 is filled with green

    ...and so on


    I found code like below, but because I'm not a codder I can't addapt this code for what I would like to achieve.

    Could someone help ?


    Sub ColorMeElmo()
       Dim i As Long, r1 As Range, r2 As Range
    
       For i = 2 To 5
          Set r1 = Range("D" & i)
          Set r2 = Range("A" & i & ":C" & i)
          If r1.Value = 1 Then r2.Interior.Color = vbRed
          If r1.Value = 2 Then r2.Interior.Color = vbBlue
          If r1.Value = 3 Then r2.Interior.Color = vbYellow
       Next i
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Change cell to a color depend on certain text
    By srgtennis in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-01-2018, 03:25 PM
  2. Pivot Table cell color change depend of partial value.
    By powerzasty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2017, 06:11 AM
  3. Specific number of cell to fill with color based in a dynamic cell range
    By Blue_Wings in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-01-2015, 09:46 AM
  4. Specific number of cell to fill with color based in a dynamic cell range
    By Blue_Wings in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-28-2015, 10:10 AM
  5. [SOLVED] change fill color of a range of cells based on color of a cell?
    By DarMelNel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2014, 04:48 PM
  6. Number change color depend if left cell turn yellow
    By unley in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-01-2011, 02:38 AM
  7. Formula to color font/cell fill based on certain range
    By 47magic in forum Excel General
    Replies: 2
    Last Post: 12-08-2008, 01:53 PM

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