Excel 怎样用VBA统计重复次数
发布网友
发布时间:2022-05-06 13:19
我来回答
共1个回答
热心网友
时间:2022-06-30 17:25
Sub fssort()
c = Selection.Column
er = ActiveSheet.UsedRange.Rows.Count
For r = 2 To er
If Range("b" & r) <> "" Then
If Cells(r, c) = "" Then
ai = 0
Else
ai = Cells(r, c)
End If
aj = Cells(r, 1)
End If
Range("ai" & r) = ai
Range("aj" & r) = aj
Next r
Range("a1:aj" & er).Sort key1:=[ai1], order1:=xldescending, key2:=[aj1], order2:=xlAscending, Header:=xlYes
End Sub