
Sub colora()
If Cells(1, 1) = Cells(2, 2) Then
Cells(1, 1).Interior.ColorIndex = 6
End If
If Cells(1, 1) = 0 Then
Cells(1, 1).Interior.ColorIndex = xlNone
End If
End Sub |
Sub colora()
Cells(1, 1).Interior.ColorIndex = xlNone
If Cells(1, 1) = Cells(2, 2) Then
Cells(1, 1).Interior.ColorIndex = 6
End If
If Cells(1, 1) = 0 Then
Cells(1, 1).Interior.ColorIndex = xlNone
End If
End Sub |
Sub colora()
Cells(1, 1).Interior.ColorIndex = xlNone
If Cells(1, 1) = Cells(2, 2) Then
Cells(1, 1).Interior.ColorIndex = 6
End If
End Sub |
Per Max
Option Explicit
' confronta celle A1 e B2, se sono uguali colora A1 di giallo
' le celle devono essere non-vuote
' non sono discriminanti gli spazi non necessari a inizio o fine cella
' quindi 'rocco ' equivale a 'rocco' che equivale a ' rocco'
Sub colora_soluzione1()
' utilizzo isEmpty()
Cells(1, 1).Interior.ColorIndex = xlNone
If Not IsEmpty(Cells(1, 1)) And Not IsEmpty(Cells(2, 2)) And Trim(Cells(1, 1)) = Trim(Cells(2, 2)) Then
Cells(1, 1).Interior.ColorIndex = 6
End If
End Sub
Sub colora_soluzione2()
' utilizzo la concatenazione di stringhe
Cells(1, 1).Interior.ColorIndex = xlNone
If Trim(Cells(1, 1) & Cells(2, 2)) <> "" And Trim(Cells(1, 1)) = Trim(Cells(2, 2)) Then
Cells(1, 1).Interior.ColorIndex = 6
End If
End Sub
|
Sub vfrac()
Dim rng As Range, riga As Range, i As Integer
Application.ScreenUpdating = False
Set rng = Range("b6:ie40")
For Each riga In rng.Rows
With riga
For i = 1 To 236
If i Mod 6 <> 5 And i Mod 6 <> 0 Then
If Not IsEmpty(.Cells(i)) And Not IsEmpty(.Cells(i + 1)) And .Cells(i) = .Cells(i + 1) Then .Cells(i).Interior.ColorIndex = 6
End If
Next
End With
Next
Application.ScreenUpdating = True
End Sub
|
