excel中VBA函数 log10()

excel中VBA函数 log10(),第1张

LOG10是工作表函数,在VBA中要使用工作表函数,必须通过 WorksheetFunction 对象:

Cells(3, k + 2).Value = Cells(6, 19) * Power((Cells(3, k) + 273) * (WorksheetFunction.Log10(Cells(3, 30)) + Cells(2, 23)) / 1000, 2) + Cells(6, 20) * Power((Cells(3, k) + 273) * (WorksheetFunction.Log10(Cells(3, 30)) + Cells(2, 23)) / 1000, 1) + Cells(6, 21)

我的excel是2003的,如果你的不是,可能filedialog不能用,那你就改一下别的方法来实现 它

Dim a As String

With Application.FileDialog(msoFileDialogOpen)

.AllowMultiSelect = False

.Show

a = .SelectedItems(1)

End With

If ActiveSheet.QueryTables.Count = 0 Then

ActiveSheet.QueryTables.Add Connection:="TEXT" &a, Destination:=Range("A1")

Else

ActiveSheet.QueryTables(1).Connection = "TEXT" &a

End If

With ActiveSheet.QueryTables(1)

.Name = "Log"

.FieldNames = True

.RowNumbers = False

.FillAdjacentFormulas = False

.PreserveFormatting = True

.RefreshOnFileOpen = False

.RefreshStyle = xlInsertDeleteCells

.SavePassword = False

.SaveData = True

.AdjustColumnWidth = True

.RefreshPeriod = 0

.TextFilePromptOnRefresh = False

.TextFilePlatform = 1252

.TextFileStartRow = 1

.TextFileParseType = xlDelimited

.TextFileTextQualifier = xlTextQualifierDoubleQuote

.TextFileConsecutiveDelimiter = False

.TextFileTabDelimiter = True

.TextFileSemicolonDelimiter = False

.TextFileCommaDelimiter = False

.TextFileSpaceDelimiter = False

.TextFileColumnDataTypes = Array(1)

.TextFileTrailingMinusNumbers = True

.Refresh BackgroundQuery:=False

.Destination = Range("A1")

End With

y=log(x)

--------------

Log 函数

返回一个 Double,指定参数的自然数值

语法

Log(number)

必要的 number 参数是 Double 或任何有效的大于 0 的数值表达式。

说明

自然对数是以 e 为底的对数。常数 e 的值大约是 2.718282。

如下所示,将 x 的自然对数值除以 n 的自然对数值,就可以对任意底 n 来计算数值 x 的对数值:

Logn(x) = Log(x) / Log(n)


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11387781.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-15
下一篇2023-05-15

发表评论

登录后才能评论

评论列表(0条)

    保存