我不知道如何将“i”添加到以下代码中。我已经完成了之前的问题,但我无法让它正常运行。想法?从“ELSE”开始,我不知道如何添加“i”。任何帮助将不胜感激。
For i = 2 To myLastRow
Set mycell = myWorksheet.Range("AK" & i)
Set mycell2 = myWorksheet.Range("AD" & i)
Else
**mycell.Offset(, 2).Formula = "==IF(ABS(AJ" & i & " - AL" & i & ") <= AL" & i & "*0.1, TRUE, FALSE) "**
答案 0 :(得分:0)
Dim i As Integer
Dim mylastrow As Integer
Dim myworksheet As Worksheet
Dim mycell As Range
Dim mycell2 As Range
Set myworksheet = Sheet1
mylastrow = 10
For i = 2 To mylastrow
Cells(i, "AK").Offset(, 2).Formula = "=IF(ABS(AJ" & i & " - AL" & i & ") <= AL" & i & "*0.1, TRUE, FALSE) "
' Cells(i, "AD").Value
Next i
你正试图这样做吗?单元格属性适用于这些类型的循环。