当前,我有一个VBA表单,其中包含4个文本框,第一个开始填充一个值,其余3个开始空白。我的目标是仅在所有3个都大于零或“”时才运行公式,并再次计算所有后续更改,前提是所有3个都具有值。我为此找到了一个稍微相似的线程,但是它是在Java而不是VBA上。到目前为止,这就是我所拥有的。我已经尝试过IF函数,但仍然会引发错误。谢谢!
Option Explicit
Public RTempFormP As Double
Private Sub UserForm_Initialize()
RTempFormP = Range("RPress1")
TextBox1 = RTempFormP
End Sub
Private Sub TextBox2_AfterUpdate()
Call RunTemp
End Sub
Private Sub TextBox3_AfterUpdate()
Call RunTemp
End Sub
Private Sub TextBox4_AfterUpdate()
Call RunTemp
End Sub
Sub RunTemp()
Dim CoeffA As Double: CoeffA = TextBox2
Dim CoeffB As Double: CoeffB = TextBox3
Dim CoeffC As Double: CoeffC = TextBox4
Dim RTempFormT As Double
RTempFormT = CoeffB / (CoeffA - Log10(RTempFormP * 14.5)) - CoeffC
Label7 = (9 / 5) * (RTempFormT - 273.15) + 32
End Sub