我有一个以日志格式显示的数据表,我需要能够更改它才能上载它。我似乎一直遇到与单元格内容被读取为字符串而不是双精度值相关的错误。
我尝试了下面代码的几种变体(使用^和power)。我能得到的最接近的变体是用公式本身而不是答案填充每个单元格。变量c正确加载,其他公式似乎也能工作。
Dim c As Range
Dim Lastrow As Long
Lastrow = ActiveWorkbook.Worksheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row
For Each c In Range("A2 :A" & Lastrow)
c = c.Power(10, c)
Next
End Sub
或
Function Antilog(rwDest As Range)
Dim c As Range
Dim Lastrow As Long
Lastrow = ActiveWorkbook.Worksheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row
For Each c In Range("A2" & Lastrow)
c.Value = "=10^ c.Value"
Next
End Function
1条答案
按热度按时间kcugc4gi1#
使用
Worksheet.Evaluate
避免循环