Çözüldü Koşullu Biçimlendirme/Say

Katılım
3 Şubat 2008
Mesajlar
593
Excel Vers. ve Dili
Office 2016 Eng. 64 Bit
Altın Üyelik Bitiş Tarihi
21-11-2024
Merhaba;

A Sütunundaki Aynı Sayıları Yeşile boyamak
B Sütunundaki Aynı Sayıları Maviye boyamak

C Sütununa A Sütunundaki Yeşil boyalı satırları saydırma
D Sütununa B Sütunundaki Mavi boyalı satırları saydırma.

Kod nasıl yazılmalı yardımcı olabilir misiniz. Teşekkürler.
 

turist

Destek Ekibi
Destek Ekibi
Katılım
18 Kasım 2009
Mesajlar
5,102
Excel Vers. ve Dili
2013 64Bit
English
Deneyin.
Kod:
Sub gicimi()
Columns("A:D").Select
   With Selection.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
For i = 1 To Cells(Rows.Count, 1).End(3).Row
If Application.WorksheetFunction.CountIf(Range("A:A"), Cells(i, 1)) > 1 Then
Cells(i, 1).Interior.ColorIndex = 4
End If
Next
For i = 1 To Cells(Rows.Count, 2).End(3).Row
If Application.WorksheetFunction.CountIf(Range("B:B"), Cells(i, 2)) > 1 Then
Cells(i, 2).Interior.ColorIndex = 8
End If
Next
For i = 1 To Cells(Rows.Count, 1).End(3).Row
If Application.WorksheetFunction.CountIf(Range("A:A"), Cells(i, 1)) > 1 Then
Cells(i, 3).Value = Application.WorksheetFunction.CountIf(Range("A:A"), Cells(i, 1))
End If
Next
For i = 1 To Cells(Rows.Count, 2).End(3).Row
If Application.WorksheetFunction.CountIf(Range("A:A"), Cells(i, 2)) > 1 Then
Cells(i, 4).Value = Application.WorksheetFunction.CountIf(Range("B:B"), Cells(i, 2))
End If
Next
End Sub
 

Ömer BARAN

Uzman
Katılım
8 Mart 2011
Mesajlar
12,997
Excel Vers. ve Dili
Office 2013 ( 32 bit ) TÜRKÇE
Altın Üyelik Bitiş Tarihi
(18.03.2020) - Uzman olduğu için tarih geçersiz oldu.
Merhaba.

Sayın turist'in müsadesiyle ve kendisiyle aynı yöntemi kullanarak tek döngü ile çözüm alternatif olsun.
Kod:
Sub gicimi_BRN()
Set wf = Application.WorksheetFunction
sonsat = wf.Max(Cells(Rows.Count, 1).End(3).Row, Cells(Rows.Count, 2).End(3).Row)
Range("A1:B" & sonsat).Interior.Color = xlNone
Range("C1:D" & sonsat).ClearContents
For brn = 1 To sonsat
    If Cells(brn, 1) <> "" And wf.CountIf(Range("A1:A" & sonsat), Cells(brn, 1)) > 1 Then
        Cells(brn, 1).Interior.ColorIndex = 4
        Cells(brn, 3) = wf.CountIf(Range("A1:A" & sonsat), Cells(brn, 1))
    End If
    If Cells(brn, 2) <> "" And wf.CountIf(Range("B1:B" & sonsat), Cells(brn, 2)) > 1 Then
        Cells(brn, 2).Interior.ColorIndex = 8
        Cells(brn, 4) = wf.CountIf(Range("B1:B" & sonsat), Cells(brn, 2))
    End If
Next
End Sub
 
Son düzenleme:
Katılım
3 Şubat 2008
Mesajlar
593
Excel Vers. ve Dili
Office 2016 Eng. 64 Bit
Altın Üyelik Bitiş Tarihi
21-11-2024
Sn. @turist @Ömer BARAN teşekkür ederim. Kolaylıklar.
 
Üst