|
帮忙看看
我执行B列,C列,H列,就出现类型不匹配,执行其他列能运行过去
Private Sub Worksheet_Change(ByVal Target As Range)
'tm = Timer
r = Target.Row '当前单元格行
c = Target.Column '当前单元格列
If c = 2 And r > 3 Then
Cells(r, 1) = r - 3
End If
'在A列自动生成序号
If c = 4 Then
Cells(r, c + 2) = Cells(r, c) - Cells(r, c + 1)
End If
'在第四列中输入令数,开始计算(未执行计划数)
If c Mod 2 = 0 And c / 2 > 5 Then
Cells(r, 7) = Application.SumIf(Range(Cells(3, 11), Cells(3, 72)), "完成", Range(Cells(r, 11), Cells(r, 72)))
If Cells(r, 7) + Cells(r, 5) > Cells(r, 4) Then
MsgBox "你的完成数超出计划数,请核查"
Cells(r, c) = ""
Cells(r, 1).Resize(1, 10).Interior.ColorIndex = 0
If Cells(r, 7) + Cells(r, 5) = Cells(r, 4) Then
Cells(r, 1).Resize(1, 10).Interior.Color = vbRed
End If
ElseIf Cells(r, 7) + Cells(r, 5) = Cells(r, 4) Then
Cells(r, 1).Resize(1, 10).Interior.Color = vbRed
Else
Cells(r, 1).Resize(1, 10).Interior.ColorIndex = 0
End If
End If
If r > 3 And c Mod 2 = 1 And c > 10 And Application.SumIf(Range(Cells(3, 11), Cells(3, c)), "完成", Range(Cells(r, 11), Cells(r, c))) + Cells(r, c) > Cells(r, 6) Then
MsgBox "此次计划数超出未执行计划数,请核查"
Cells(r, c) = ""
End If
'MsgBox "运行时间:" & Timer - tm
End Sub
有错误三 Cells(r, c))) + Cells(r, c) > Cells(r, 6) 运行时,这是文字,不是数错,则要出错
|
|