vba 调用 countif 函数问题
源数据是A1:G18,需求是在K列显示A1:A18中各单元格重复出现的次数。在L列中是用countif函数直接计算的,
Private Sub test() Dim rng As Range, i As Integer i = 1 For Each rng In Range("A1:A18") Range("I" & i) = Application.WorksheetFunction.CountIf(Range("A" & i & ":G18"), Range("A" & i)) i = i + 1 Next rng End Sub