Private Sub Worksheet_Change(ByVal Target As Range) Dim ar, br, str ar = Array("销售单", "救援单", "进货单", "销退单", "报销单", "其他单据") br = Array("XS01", "WX01", "JH01", "XT01", "BX01", "") Application.ScreenUpdating = False If Target.Count > 1 Then Exit Sub If Target.Row > 2 And Target.Column = 2 Then Target.EntireRow.Interior.Color = xlNone Target.Offset(0, -1) = Date Cells(Target.Row, "k").Resize(1, 6) = Array("=RC[-2]+RC[-1]", "=IF(RC[-10]=""销售单"",RC[-2]/COUNTA(RC[-8]:RC[-6]),IF(RC[-10]=""救援单"",RC[-2]/COUNTA(RC[-8]:RC[-6]),0))", Cells(Target.Row, "m"), "=RC[-3]-RC[-1]", "=IF(RC[-4]<>0,RC[-2]/RC[-4],0)", "=IF(RC[-1]>=100%,""已完结"",""未完结"")") If Cells(Target.Row, "o") < 1 Then Cells(Target.Row, 1).Resize(1, 17).EntireRow.Interior.Color = vbRed str = Format(Application.CountIf([c:c], br(Application.Match(Target, ar, 0) - 1) & Format(Date, "yyyymmdd") & "*") + 1, "000") Cells(Target.Row, "c") = "'" & br(Application.Match(Target, ar, 0) - 1) & Format(Date, "yyyymmdd") & str ElseIf Target.Row > 2 And InStr("9,10,13", Target.Column) Then If Application.Sum(Cells(Target.Row, 9).Resize(1, 2)) <> 0 Then If (Cells(Target.Row, "m") / Application.Sum(Cells(Target.Row, 9).Resize(1, 2))) >= 1 Then Target.EntireRow.Interior.Color = xlNone End If End If Application.ScreenUpdating = True End Sub
高手啊!!能不能帮我改下代码?我的要求写的有点多。这里放不下,只能弄成照片吧。