它并不像LastRow那样读取数字!救命!!这是我的代码:
Sub DD()
Dim rNum As Long
Dim LastRow As Long
LastRow = ActiveSheet.Range("A1").End(xlDown).Rows.Count
For rNum = 2 To LastRow
Select Case Range("D" & rNum).Value
Case "FXD"
Range("P" & rNum).FormulaR1C1 = "= RC[-13]"
Case Else
Range("P" & rNum).Value = -4
End Select
Next rNum
End Sub
答案 0 :(得分:0)
更改此行:
LastRow = ActiveSheet.Range("A1").End(xlDown).Rows.Count
到此:
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlup).Row
你想要Row
而不是Rows.Count
(因为你指的是一个单元格,它总是1)而且从表格底部上升通常会更好而不是下来。