我要突出显示并计算单个串联列中重复项的数量。
我现在将其作为两个单独的潜艇,而且确实没有太多要说的了,这对我有信心的问题来说并不难,但是我已经为之努力了好几天了,进展。它必须在VBA中完成,并且不能突出显示该列中的空白单元格。串联是通过工作簿中的公式完成的。请救我,我快死了,
Sub Duplicate_Check()
Dim ws As Worksheet
Set ws = Sheet1
Worksheets("Master Checklist").Activate
Columns("H:H").Select
Selection.FormatConditions.AddUniqueValues
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).DupeUnique = xlDuplicate
With Selection.FormatConditions(1).Interior
.ColorIndex = 40
.TintAndShade = 0
End With
'Sheet2.Range(“L2").Value = Application.WorksheetFunction.Countif(Columns("H:H")), cell.Font.Color = "-16383844")
'Range(“B10?).Value = Application.WorksheetFunction.Countif(Range(“A2:A8?), “>” & 50
End Sub
Sub CountDupes()
Dim countofDupes As Long
Dim rng As Range
Dim myCell As Range
countofDupes = 0
Set rng = Range("H2").End(xlDown)
For Each myCell In rng
If myCell.Interior.ColorIndex = 40 Then
countofDupes = countofDupes + 1
Debug.Print countofDupes
End If
Next myCell
End Sub
我没有遇到任何错误消息,但是如果我Debug.Print countofDupes
却什么也没有返回,这显然不是我想要的。有什么建议吗?