Sub 抽离数字() Dim hang Range("h1").Select Columns("E:F").Select Selection.Clear Range("c3:c190").Select Selection.Replace What:="(", Replacement:="(", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, MatchByte:=False, SearchFormat:=True, ReplaceFormat:=True Selection.Replace What:=")", Replacement:=")", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, MatchByte:=False, SearchFormat:=True, ReplaceFormat:=True For ccc = 3 To 100 aa = ActiveSheet.Cells(ccc, 3).Value bb = Split(aa, "(") For aai = 1 To UBound(bb) hang = ActiveSheet.Cells(1, 8).Value bb2 = Split(bb(aai), ")") If Asc(Mid(bb2(0), 1, 1)) > 0 Then If Int(bb2(0)) > 0 Then ActiveSheet.Cells(hang + 3, 6).Value = Int(bb2(0)) ActiveSheet.Cells(hang + 3, 5).Value = ActiveSheet.Cells(ccc, 2).Value End If End If Next For ff = 3 To 90 If ActiveSheet.Cells(ff, 6).Value = 0 Or ActiveSheet.Cells(ff, 6).Value = "" Then ActiveSheet.Cells(ff, 6).Select Selection.Delete Shift:=xlShiftUp End If Next Next '跳到顶端 ActiveWindow.ScrollRow = 1 End Sub Sub 替换() Range("c3:c190").Select Selection.Replace What:="(", Replacement:="(", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, MatchByte:=False, SearchFormat:=True, ReplaceFormat:=True Selection.Replace What:=")", Replacement:=")", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, MatchByte:=False, SearchFormat:=True, ReplaceFormat:=True End Sub
H1 输入公式 =COUNT(F:F)
B3 输入考勤负责人
C3 为该部门的人 ,名字(工号)