为我妈写的自动统计的VBA程序
2016-05-08 23:15
591 查看
<span style="font-size:18px;">先祝天底下所有母亲节日快乐、青春永驻</span>
<span style="font-size:18px;">Private Sub CommandButton1_Click() With Application.WorksheetFunction On Error Resume Next Dim oExcel, oWb, oSheet Range("K:K").Value = "" Range("L:L").Value = "" Range("K1").Value2 = "姓名" Range("L1").Value = "休息天数" Dim i, j, Num As Integer Num = 0 While Cells(i + 1, 1).Value <> "" i = i + 1 j = 0 j = .Match(Cells(i, 1).Value, Range(Cells(1, 11), Cells(Num + 1, 11)), 0) If j = 0 Then Num = Num + 1 j = Num + 1 Cells(j, 11).Value = Cells(i, 1).Value End If Cells(j, 12).Value = Cells(j, 12).Value + .CountIf(Range(Cells(i, 2), Cells(i, 8)), "休") Wend MsgBox "共统计 " & Str(i) & " 项,共 " & Str(Num) & " 人" End With End Sub</span>
相关文章推荐