0
我正在爲我的類項目執行線性插值。我創建了一個插值函數,並且必須動態執行計算,因爲每個問題的列數都不相同。所以,我已經檢索了最後一列(ltr)的值並嘗試將它與R1C1格式連接起來。但它不起作用。你能否提出一些建議,如何解決這個問題。 請找到下面的代碼如下:以RC風格表示法vba宏連接單元格區域
Private Sub TrialCheck_Click()
Dim lrt As Double
With ActiveSheet
'retrives last column i.e lrt = 447
lrt = .Cells(.Rows.Count, "F").End(xlUp).Row
End With
Range("I3").Value = Range("F3").Value * Range("B3").Value
Range("I58").Value = Range("F" & lrt).Value * Range("B58").Value
'MacroR
'following works as 447 is hardcoded
'Range("I4").Value = _
"=(LinInterp(RC[-8],R4C[-4]:R447C[-4],R4C[-3]:R447C[-3])*RC[-7])"
'following code doesn't concatenate value of lrt
Range("I4").Value = _
"=(LinInterp(RC[-8],R4C[-4]:R&lrt&C[-4],R4C[-3]:R&lrt&C[-3])*RC[-7])"
Range("J4").Select
Range("I4").AutoFill Destination:=Range("I4:I57"), Type:=xlFillDefault
Range("I4:I57").Select
End Sub