当b值达到100左右时就会溢位,想请问如何解决
程式码如下所示:
Sub cal()
Dim b As Long
n = Range("H3")
r = Range("H4")
b = Range("H5")
For i = 3 To n + 2
Cells(i, 4) = Cells(i, 2) ^ b ← 溢位
Cells(i, 5) = WorksheetFunction.Ln(Cells(i, 2))
Next i
Cells(6, 8) = (WorksheetFunction.Sum(Range(Cells(3,4),Cells(n+2,4)))/r)^(1/ b)
End Sub
谢谢
Cells(i,4)=CLng(Cells(i,2).Value)^b试试看,因为不清楚你数字到底放到多大Cells(i,4)=CDec(Cells(i,2).Value)^CDec(b)