Excel Forum Per condividere esperienze su Microsoft Excel

Colorazione automatica/dinamica cella a seconda del suo valore

  • Messaggi
  • OFFLINE
    andreabaraldi
    Post: 13
    Registrato il: 26/09/2018
    Città: PISOGNE
    Età: 44
    Utente Junior
    2016
    00 02/10/2018 16:43
    Buongiorno,

    è tutto il giorno che cerco di far colorare automaticamente una cella di verde piuttosto che di rosso in base al valore, ma non ci riesco in nessun modo! Perchè non funziona?
    Help... grazie 2000

    Private Sub Worksheet_Change(ByVal Target As Range)
    Sheets("Tabelle").Select
    If Range("N16").Value > N19 Then
    Range("N16").Select
    With Selection.Interior
    .ColorIndex = 3 ' colore rosso
    .Pattern = xlSolid
    End With
    End If
    If Range("N16").Value <= N19 Then
    Range("N16").Select
    With Selection.Interior
    .ColorIndex = 4 ' colore verde
    .Pattern = xlSolid
    End With
    End If
    End Sub

    Saluti

    Andrea
  • OFFLINE
    federico460
    Post: 1.724
    Registrato il: 10/10/2013
    Città: VICENZA
    Età: 69
    Utente Veteran
    365
    10 02/10/2018 17:14
    ciao

    chiediti cosa vuol dire per il vba >N19


    Private Sub Worksheet_Change(ByVal Target As Range)
    Sheets("Tabelle").Select
    If Range("N16").Value > Range("N19").Value Then
    Range("N16").Select
    With Selection.Interior
    .ColorIndex = 3 ' colore rosso
    .Pattern = xlSolid
    End With
    Else
    If Range("N16").Value <= Range("N19").Value Then
    Range("N16").Select
    With Selection.Interior
    .ColorIndex = 4 ' colore verde
    .Pattern = xlSolid
    End With
    End If
    End If
    End Sub

  • OFFLINE
    locatevaresino
    Post: 2.088
    Registrato il: 21/03/2008
    Città: LOCATE VARESINO
    Età: 76
    Utente Veteran
    2007 / 13
    10 02/10/2018 18:47
    ciao

    intanto saluto federico

    dovendo fare due semplici operazioni possiamo ridurre tutta la sub()


    Private Sub Worksheet_Change(ByVal Target As Range)
    Sheets("Tabelle").Select
    If Range("N16").Value > Range("N19").Value Then
    Range("N16").Interior.ColorIndex = 3 ' colore rosso
    Else
    Range("N16").Interior.ColorIndex = 4 ' colore verde
    End If
    End Sub

    Ciao da locate
    excel 2007 / 13
  • OFFLINE
    andreabaraldi
    Post: 14
    Registrato il: 26/09/2018
    Città: PISOGNE
    Età: 44
    Utente Junior
    2016
    00 03/10/2018 07:53
    Grazie locate e grazie federico!
    [SM=x423017]
  • 15MediaObject5,0024 2