- Katılım
- 5 Haziran 2006
- Mesajlar
- 6,886
- Excel Vers. ve Dili
- 2021 Türkçe
Kodlar kopyala yapıştıra uygun değildi onun için hata veriyordu.
Revize edilmiş kodlar aşağıda.
Revize edilmiş kodlar aşağıda.
Kod:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim AktifHcreler As Range
Dim Bak As Range
Dim Hcr As Range
Dim Renk1 As Variant
Dim Renk2 As Variant
On Error GoTo Hata:
If Intersect(Target, Range("D:W")) Is Nothing Then Exit Sub
Set AktifHcreler = Intersect(Target, Range("D:W"))
For Each Bak In AktifHcreler
If Not Intersect(Bak, Range("D:M")) Is Nothing Then
Set Hcr = Bak(1, 11)
Renk1 = 65535
Renk2 = 5287936
ElseIf Not Intersect(Bak, Range("N:W")) Is Nothing Then
Set Hcr = Target(1, -9)
Renk1 = 5287936
Renk2 = 65535
Else
Exit Sub
End If
Application.EnableEvents = False
If Bak = "" Or Hcr = "" Then
Bak.Interior.Pattern = xlNone
Hcr.Interior.Pattern = xlNone
Else
If Cells(Bak.Row, "C") = "üst" Then
If Bak > Hcr Then
Bak.Interior.Color = Renk1
Hcr.Interior.Color = Renk1
ElseIf Bak < Hcr Then
Bak.Interior.Color = Renk2
Hcr.Interior.Color = Renk2
ElseIf Bak = Hcr Then
Bak.Interior.Pattern = xlNone
Hcr.Interior.Pattern = xlNone
End If
ElseIf Cells(Bak.Row, "C") = "alt" Then
If Bak > Hcr Then
Bak.Interior.Color = Renk2
Hcr.Interior.Color = Renk2
ElseIf Bak < Hcr Then
Bak.Interior.Color = Renk1
Hcr.Interior.Color = Renk1
ElseIf Bak = Hcr Then
Bak.Interior.Pattern = xlNone
Hcr.Interior.Pattern = xlNone
End If
End If
End If
Next
Hata:
Application.EnableEvents = True
End Sub
