Option Explicit
Sub AAA()
Dim i, j As Long '这句最后一个变量后面没有逗号,而且应该这样写 dim i as long ,j as long
Dim Otype, Prate As String
Dim D As Date
i = ActiveCell
Otype = ActiveCell.Offset(0, -3)
Prate = ActiveCell.Offset(0, -1)
If Prate = "快单" Then
'下面这句修改如下
j = WorksheetFunction.RoundUp((Worksheets("负荷统计").Cells(4, 7) + i) / Worksheets("负荷统计").Cells(10, 12), 0)
If j < 6 Then
D = Worksheets("订单明细").Cells(1, 2)
Else '修改
D = Worksheets("订单明细").Cells(1, 2) + j - 6
End If
ActiveCell.Offset(0, 8) = D
ActiveCell.Offset(0, 7) = D + 11
Else '修改
'下面一句 修改
j = WorksheetFunction.RoundUp((Worksheets("负荷统计").Cells(5, 7) + i) / Worksheets("负荷统计").Cells(10, 12), 0)
If j < 6 Then
D = Worksheets("订单明细").Cells(1, 2)
Else '修改
D = Worksheets("订单明细").Cells(1, 2) + j - 6
End If
ActiveCell.Offset(0, 8) = D
ActiveCell.Offset(0, 7) = D + 11
End If
End Sub
eles改为else
有几处eles应为else