私はコードを変更しました。
Option Explicit
Public Function Isokinectic(streamVelocity As Double, sampleVelocity As Double, probeDiameter As Double, density As Double, particleDiameter As Double, viscosity As Double)
Dim s As Double
Dim stk_coefficent As Double
Dim stk As Double
Dim d As Double
s = ((0.16 * 10^-4)/particleDiameter) + 1
stk_coefficent = (1/(18 * viscosity)) * density * particleDiameter * particleDiameter * s
stk = (streamVelocity/probeDiameter) * stk_coefficent
d = 1 + (2 + 0.62 * (sampleVelocity/streamVelocity)) * stk
Isokinectic = 1 + ((streamVelocity/sampleVelocity) - 1) * (1 - 1/(d))
End Function
しかし、動作しません。しかし、サブMAIN()を追加するときは、このようにします。できます。
Option Explicit
Function Isokinectic(streamVelocity As Double, sampleVelocity As Double, probeDiameter As Double, density As Double, particleDiameter As Double, viscosity As Double)
Dim s As Double
Dim stk_coefficent As Double
Dim stk As Double
Dim d As Double
s = ((0.16 * 10^-4)/particleDiameter) + 1
stk_coefficent = (1/(18 * viscosity)) * density * particleDiameter * particleDiameter * s
stk = (streamVelocity/probeDiameter) * stk_coefficent
d = 1 + (2 + 0.62 * (sampleVelocity/streamVelocity)) * stk
Isokinectic = 1 + ((streamVelocity/sampleVelocity) - 1) * (1 - 1/(d))
End Function
Sub MAIN()
MsgBox Isokinectic(0.1, 0.2, 0.3, 0.4, 0.5, 0.6)
End Sub
オリジナルポスト:
私は、Excel関数の式をコーディングしてみました。しかし、#valueを得ました
Function Isokinectic(streamVelocity As Double, sampleVelocity As Double, probeDiameter As Double, density As Double, particleDiamter As Double, visocity As Double)
Dim s As Double
Dim stk_coefficent As Double
Dim stk As Double
Dim d As Double
s = (0.16 * 10^ - 4/particleDiameter) + 1
stk_coefficent = (1/(18 * viscosity)) * density * particleDiamter * particleDiameter * s
stk = (streamVelocity/probeDiameter) * stk_coefficent
d = 1 + (2 + 0.62 * (sampleVelocity/streamVelocity)) * stk
Isokinectic = 1 + ((streamVelocity/sampleVelocity) - 1) * (1 - 1/(1 + d))
End Function
私はこのコードで間違っていましたか?少しクリーンアップで
私にとってはうまく動作しています。どのように呼びますか?> –
挿入機能。次に、変数を入力します。 – JOHN
ヘッダーのタイプミス*** particleDiamter ***は*** particleDiameter ***以外の問題もあります –