[英]I need help fixing this VBA macro
我是 VBA 的新人。我不知道如何使用它,但我正在嘗試。 我正在嘗試創建一個代碼來說明:
如果 tmin < t < tmax 則在注釋欄的單元格中輸入“有效”,但如果不是則僅輸入“無效”
如果有效則檢查參數是否 < 0.001 然后將“Valid & LN”放入單元格
如果參數 > 0.001 只放“有效”
如果參數 > 10 放“有效 & 0”
這是我的嘗試,但不起作用
Option Explicit
Function VC(t As Double, argument As Double, tmax As Double, tmin As Double) As Double
Dim i As String
If tmin < t < tmax And argument < 0.001 Then
i = "Valid & LN"
ElseIf argument > 10 Then
i = "Valid & 0"
Else
i = "invalid"
End If
End Function
這是它的外觀以及我正在使用的列:
Tmax 和 Tmin 細胞
時間、參數以及評論單元格的外觀
我的猜測是
Option Explicit
Function VC(t As Double, argument As Double, tmax As Double, tmin As Double) As String
Dim i As String
If tmin < t And t < tmax Then
i = "Valid"
If argument < 0.001 Then
i = "Valid & LN"
ElseIf argument > 10 Then
i = "Valid & 0"
End If
Else
i = "invalid"
End If
VC = i
End Function
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.