Sub 按钮1_单击() Set myb = CreateObject("scripting.dictionary"): myb("数字") = "次数"Set rng = Application.InputBox("选择要统计的区域:", Type:=8) ActiveSheet.Cells.Interior.ColorIndex = 0 rng.Interior.ColorIndex = 3 For Each rng1 In rng myb(rng1.Value) = Application.WorksheetFunction.CountIf(rng, rng1) Next Set rng3 = Application.InputBox("选择结果输出地:", Type:=8) With rng3 .Resize(myb.Count) = Application.Transpose(myb.keys) .Offset(, 1).Resize(myb.Count) = Application.Transpose(myb.items) End With Set myb = Nothing: Set rng3 = NothingEnd Sub附件:Book1.xls