此行顯示了運行時錯誤1004,但我不明白爲什麼:VBA - 錯誤1004
ActiveCell.Formula = "=MATCH(R" & i & "C16;R" & i & "C6:R" & i & "C15;0)"
Sub Call_Min()
Dim i As Integer
Dim limit As Integer
Sheets("AUX").Activate
limit = ActiveSheet.Range("B6").Value
Sheets("DATA").Activate
'ActiveSheet.Cells(6, 16).Select
'ActiveCell.Formula = "=SUM(Range("F6:I6"))"
For i = 6 To limit
'MATCH(P6;F6:O6;0)
ActiveSheet.Range("P" & i).Select
ActiveCell.Formula = "=MIN(R" & i & "C6:R" & i & "C15)"
ActiveSheet.Range("E" & i).Select
ActiveCell.Formula = "=MATCH(R" & i & "C16;R" & i & "C6:R" & i & "C15;0)"
Next i
End Sub
它應該是'ActiveCell.FormulaR1C1'而不是'ActiveCell.Formula'。 – Ralph
將'ActiveCell.Formula'改爲'ActiveCell.FormulaR1C1Local' –