La consultazione del forum è libera per tutti.
Per poter porre un quesito è invece necessario essere un utente registrato (clicca qui se non lo sei).
Tutti gli utenti che richiedono un supporto, come da REGOLAMENTO, sono caldamente invitati ad allegare un file di esempio con l'indicazione di quello che si desidera ottenere.
Buongiorno sto cercando fi creare una formattazione condizionale con il vba, ma essendo poco pratico ho cercato di scrivere cmq un codice che potesse soddisfare la mia esigenza , però non funziona correttamente.
C'è qualcuno che riesce a darmi una mano a riguardo?
Allego un file dove si evince il risultato che vorrei ottenere con il codice inserito
Vi ringrazio anticipatamente
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("A2:T2000")) Is Nothing Then If Target.Rows.Count > 1 Then Exit Sub Application.EnableEvents = False Application.EnableEvents = True End If Dim i As Long For i = 2 To 2000 If Cells(i, "K") = "URGENTISSIMO" Then 'Coloro K With Cells .Interior.Color = RGB(255, 0, 0) .Font.Color = 3 End With 'Coloro A:D With Cells(Cells.Row, "A").Resize(, 4) .Interior.Color = RGB(255, 0, 0) .Font.Color = 3 End With 'Coloro L With Cells(Cells.Row, "K").Resize(, 2) .Interior.Color = RGB(255, 0, 0) .Font.Color = 3 End With If Cells(i, "K") = "URGENTE DA SPEDIRE" Then 'Coloro K With Cells .Interior.Color = RGB(255, 0, 255) .Font.Color = 3 End With 'Coloro A:D With Cells(Cells.Row, "A").Resize(, 4) .Interior.Color = RGB(255, 0, 255) .Font.Color = 3 End With 'Coloro L With Cells(Cells.Row, "K").Resize(, 2) .Interior.Color = RGB(255, 0, 255) .Font.Color = 3 End With ElseIf Cells(i, "K") = "NORMALE" Then 'Coloro K: L With Cells(Cells.Row, "K").Resize(, 2) .Interior.Color = RGB(153, 204, 0) .Font.Color = 3 End With ElseIf Cells(i, "K") = "SPEDITO" Then 'Coloro K: L With Cells(Cells.Row, "K").Resize(, 2) .Interior.Color = RGB(153, 204, 0) .Font.Color = 3 End With ElseIf Cells(i, "K") = "ATTESA SPEDIZIONE" Then 'Coloro J: K With Cells(Cells.Row, "J").Resize(, 2) .Interior.Color = RGB(153, 51, 0) .Font.Color = 3 End With If Cells(i, "H") = "CONSEGNATO A MARIO" Then With Cells .Interior.Color = RGB(153, 204, 0) .Font.Color = 3 End With ElseIf Cells(i, "H") = "ATTESA MATERIALE" Then 'Coloro H With Cells .Interior.Color = RGB(0, 204, 255) .Font.Color = 3 End With 'Coloro B:C With Cells(Cells.Row, "B").Resize(, 2) .Interior.Color = RGB(0, 204, 255) .Font.Color = 3 End With 'Coloro K:L With Cells(Cells.Row, "K").Resize(, 2) .Interior.Color = RGB(0, 204, 255) .Font.Color = 3# End With ElseIf Cells(i, "H") = "ATTESA INFO" Then 'Coloro H With Cells .Interior.Color = RGB(255, 0, 255) .Font.Color = 3 End With 'Coloro B:C With Cells(Cells.Row, "B").Resize(, 2) .Interior.Color = RGB(255, 0, 255) .Font.Color = 3 End With 'Coloro K:L With Cells(Cells.Row, "K").Resize(, 2) .Interior.Color = RGB(255, 0, 255) .Font.Color = 3 End With End If End If Next i End Sub
ciao
hai la stessa domanda su tre forum almeno
dovresti leggere il regolamento prima di postare.
in questo è vietato il cross posting
poi se non riuscite con il vba
la formattazione condizionale è fatta appositamente per risolvere questi quesiti.
devo chiuderti