
Sub Evidenziatore_Automatico()
Sheets("Foglio2").Select
riga
If Range("D22") = "p" Or Range("D22") = "c" Then
Range("D22:G22").Select
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Else
Range("D22:G22").Select
With Selection.Interior
.ColorIndex = 2
End With
End If
End Sub |
For riga = 7 To 21
For colonna = 1 To 6
If Cells(riga, 1) = "p" Or Cells(riga, 1) = "c" Then
Cells(riga, colonna).Select
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Else
Cells(riga, colonna).Select
With Selection.Interior
.ColorIndex = 2
End With
End If |
Sub Evidenziatore_Automatico_by_vfrac()
Dim v As Variant
[A7:G21].Interior.ColorIndex = 2
For Each v In [A7:A21]
If v Like "[pc]" Then
With Range(Cells(v.Row, 1), Cells(v.Row, 6)).Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
End If
Next
End Sub |
For Each v In [A7:F21] |
Sub Evidenziatore_Automatico_by_vfrac2()
Dim c As Range, f As String, v As Variant
[A7:F21].Interior.ColorIndex = 2
For Each v In Array("p", "c")
Set c = [A7:F21].Find(v)
If Not c Is Nothing Then
f = c.Address
Do
With Range(Cells(c.Row, 1), Cells(c.Row, 6)).Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Set c = [A7:F21].FindNext(c)
Loop While Not c Is Nothing And f <> c.Address
End If
Next
End Sub
|
