我的代码有问题...看起来像这样
Worksheets("Daily Consump").Cells(67, OutputNumber).Value = (CDbl(Kiln.Cells(25, OutputNumber + 3).Value) - CDbl(Kiln.Cells(25, OutputNumber + 2).Value)) * CDbl(Kiln.Cells(25, 4).Value)
Worksheets("Daily Consump").Cells(68, OutputNumber).Value = (CDbl(Kiln.Cells(26, OutputNumber + 3).Value) - CDbl(Kiln.Cells(26, OutputNumber + 2).Value)) * CDbl(Kiln.Cells(26, 4).Value)
Worksheets("Daily Consump").Cells(69, OutputNumber).Value = (CDbl(Kiln.Cells(27, OutputNumber + 3).Value) - CDbl(Kiln.Cells(27, OutputNumber + 2).Value)) * CDbl(Kiln.Cells(27, 4).Value)
Worksheets("Daily Consump").Cells(70, OutputNumber).Value = (CDbl(Kiln.Cells(28, OutputNumber + 3).Value) - CDbl(Kiln.Cells(28, OutputNumber + 2).Value)) * CDbl(Kiln.Cells(28, 4).Value)
Worksheets("Daily Consump").Cells(71, OutputNumber).Value = (CDbl(Kiln.Cells(29, OutputNumber + 3).Value) - CDbl(Kiln.Cells(29, OutputNumber + 2).Value)) * CDbl(Kiln.Cells(29, 4).Value)
Worksheets("Daily Consump").Cells(72, OutputNumber).Value = (CDbl(Kiln.Cells(30, OutputNumber + 3).Value) - CDbl(Kiln.Cells(30, OutputNumber + 2).Value)) * CDbl(Kiln.Cells(30, 4).Value)
Worksheets("Daily Consump").Cells(73, OutputNumber).Value = (CDbl(Kiln.Cells(31, OutputNumber + 3).Value) - CDbl(Kiln.Cells(31, OutputNumber + 2).Value)) * CDbl(Kiln.Cells(31, 4).Value)
我认为我的代码不好,你有什么建议用简单的代码制作它,也许使用循环,但我有任何失败:这里是我的试验
'For k = 25 To 31
' For j = 67 To 73
' Worksheets("Daily Consump").Cells(j, OutputNumber).Value = (CDbl(Kiln.Cells(k, OutputNumber + 3).Value) - CDbl(Kiln.Cells(k, OutputNumber + 2).Value)) * CDbl(Kiln.Cells(k, 4).Value)
' Next j
'Next k
请告诉我该怎么做