+ Reply to Thread
Results 1 to 6 of 6

How to fill range od cell with color depend of value

  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 ?


    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to fill range od cell with color depend of value

    You can do it with Conditional Formatting

    Run this macro one time to set it up.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    03-01-2020
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    3

    Re: How to fill range od cell with color depend of value

    Great job! Thank You !
    my problem is solved!

    only one ask. You wrote:
    Run this macro one time to set it up.
    Is there any problem if I would like to fire this marko every time when I cut and copy cells?
    ...some dates are hold in memory or something like this ?
    I'm asking because when I cut and paste a cell from row 6 a new place for the cell in row 6 is blank.
    When I re-enter makro a field is correctly filled.

    ...anyway your code is realy very helpful!

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: How to fill range od cell with color depend of value

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.) You do well to do the same on the other forums as well.

    Since you are new to the forum and unable to post links until you have a few more posts I've gone ahead and done it for you.

    http://www.excelforum.pl/topics3/kop...go-vt67406.htm
    Dave

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to fill range od cell with color depend of value

    Quote Originally Posted by KertLopper View Post
    Is there any problem if I would like to fire this marko every time when I cut and copy cells?
    Not a problem to run the macro every time you paste.

    Or when you paste, right-click on the cell you want to paste to, select Paste Special; Values. That should preserve the Conditional Formatting.

  6. #6
    Registered User
    Join Date
    03-01-2020
    Location
    Poland
    MS-Off Ver
    2016
    Posts
    3

    Re: How to fill range od cell with color depend of value

    Thank You!
    solved !

+ Reply to Thread

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. 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