Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    show color in cell... (2000 sr 1)

    assuming have this sheet with value into column G, and a list cell into D8 is possible to colorize, the cell with the same color...

    Example:
    if i select AAAA after the selection colorize the value selected in cell D8 in yellow, CCCCC in green ecc....

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: show color in cell... (2000 sr 1)

    You can use the Worksheet_Change event in the worksheet module: right-click the sheet tab of Foglio1 and select View Code from the popup menu. Copy the following code into the module:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim r As Range
    If Not Intersect(Target, Range("D8")) Is Nothing Then
    Set r = Range("G8:G12").Find(What:=Range("D8"), LookIn:=xlValues, _
    LookAt:=xlWhole)
    If r Is Nothing Then
    Range("D8").Interior.ColorIndex = xlColorIndexNone
    Else
    Range("D8").Interior.ColorIndex = r.Interior.ColorIndex
    End If
    End If
    End Sub

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: show color in cell... (2000 sr 1)

    work perfect... but if i would want to copy the cell in D8 from D9xxxx...?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: show color in cell... (2000 sr 1)

    Like this:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim r As Range
    Dim c As Range
    ' Change range as needed
    If Not Intersect(Target, Range("D8100")) Is Nothing Then
    For Each c In Intersect(Target, Range("D8100"))
    Set r = Range("G8:G12").Find(What:=c, LookIn:=xlValues, LookAt:=xlWhole)
    If r Is Nothing Then
    c.Interior.ColorIndex = xlColorIndexNone
    Else
    c.Interior.ColorIndex = r.Interior.ColorIndex
    End If
    Next c
    End If
    End Sub

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: show color in cell... (2000 sr 1)

    <img src=/S/artist.gif border=0 alt=artist width=34 height=29> !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •