+ Reply to Thread
Results 1 to 4 of 4

Is it possible to change colors of cells based on value in cell (.

  1. #1
    LC
    Guest

    Is it possible to change colors of cells based on value in cell (.

    I would like to have the background of cell automatically shaded in grey
    level based on the value contained in the cell (values between 0-255).
    0 would correspond to Black
    255 to white

  2. #2
    Bob Phillips
    Guest

    Re: Is it possible to change colors of cells based on value in cell (.

    Conditional formatting - see http://www.contextures.com/xlCondFormat01.html

    --
    HTH

    -------

    Bob Phillips
    "LC" <[email protected]> wrote in message
    news:[email protected]...
    > I would like to have the background of cell automatically shaded in grey
    > level based on the value contained in the cell (values between 0-255).
    > 0 would correspond to Black
    > 255 to white




  3. #3
    Michael
    Guest

    RE: Is it possible to change colors of cells based on value in cell (.

    Hi LC
    Highlight all cells you want to be affected by the condition
    Click on Format/Conditional Formatting
    Cell value between 0 and 255, set your formats, Click Add
    Cell value greater than 255, set your formats, Click Add
    Click OK

    HTH
    Michael

    "LC" wrote:

    > I would like to have the background of cell automatically shaded in grey
    > level based on the value contained in the cell (values between 0-255).
    > 0 would correspond to Black
    > 255 to white


  4. #4
    JulieD
    Guest

    Re: Is it possible to change colors of cells based on value in cell (.

    Hi

    so if the cell value was 0 you want black, if it was 128 you want a mid-grey
    and if it was 255 you want white - with all graduations between?

    if this is so, i don't think excel will show the graduations as distinct as
    you wish, but you could try the following code:

    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim gcolour As Long

    If Target.Address = "$K$4" And Target.Value <> "" Then
    gcolour = Target.Value
    Target.Interior.Color = RGB(gcolour, gcolour, gcolour)
    End If
    End Sub

    ---
    to use the code, right mouse click on the sheet tab of the sheet you want
    the code to work in, choose view code and paste this code on the right hand
    side of the screen.
    change the K4 to the cell you're interested in formatting.

    Cheers
    JulieD

    "LC" <[email protected]> wrote in message
    news:[email protected]...
    >I would like to have the background of cell automatically shaded in grey
    > level based on the value contained in the cell (values between 0-255).
    > 0 would correspond to Black
    > 255 to white




+ 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