|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 panhua0624 于 2024-4-12 21:24 编辑
' 保存订单 Macro
Dim lastRow As Long
With Sheets("计划表")
lastRow = .UsedRange.Rows.Count + 1 '取最后一个空行的行号
Dim data() As Variant
ReDim data(0 To Application.WorksheetFunction.CountA([C5:C300]) - 1, 26)
For i = 0 To UBound(data, 1)
If Cells(i + 6, 1) <> "" Then
data(i, 0) = [AG3]
data(i, 2) = Cells(i + 6, 2)
data(i, 1) = Cells(i + 6, 1)
data(i, 3) = Cells(i + 6, 3)
data(i, 4) = Cells(i + 6, 4)
data(i, 5) = Cells(i + 6, 5)
data(i, 6) = Cells(i + 6, 6)
data(i, 7) = Cells(i + 6, 7)
data(i, 8) = Cells(i + 6, 9)
data(i, 9) = Cells(i + 6, 10)
data(i, 10) = Cells(i + 6, 11)
data(i, 11) = Cells(i + 5, 12)
data(i, 12) = Cells(i + 6, 13)
data(i, 13) = Cells(i + 6, 14)
data(i, 14) = Cells(i + 6, 15)
data(i, 15) = Cells(i + 6, 16)
data(i, 16) = Cells(i + 6, 17)
data(i, 17) = Cells(i + 6, 20)
data(i, 18) = Cells(i + 6, 21)
data(i, 19) = Cells(i + 6, 35)
data(i, 20) = Cells(i + 6, 32)
data(i, 21) = "=IF(RC23="""",TODAY()-RC1,IF(RC23>0,RC23-RC1))"
data(i, 23) = "=IF(RC23<>"""",""完成"",""未完成"")"
End If
Next
.Range("A" & lastRow & ":X" & lastRow + UBound(data, 1)).Value = data
End With
ActiveWorkbook.Save
MsgBox "保存完毕", , "提示"
End Sub
data(i, 21) = "=IF(RC23="""",TODAY()-RC1,IF(RC23>0,RC23-RC1))"
data(i, 23) = "=IF(RC23<>"""",""完成"",""未完成"")"
这两个输入单元格要变成公式,怎么改
|
|