当仅检查"每个项目限制"的"是"时,表格A适用。当勾选"每个位置限制"时,表格 B 适用。但是,如果我同时检查两者,则表格C适用。
我包括了我用于每个复选框的电子表格和公式。 check9 用于每个项目的限制,而 check10 用于每个位置的限制。
电子表格
Private Sub check9_Click()
If check9.Value = True Then
Range("G24").Value = "Form A"
Else
Range("G24").Value = " "
End If
End Sub
Private Sub check10_Click()
If check10.Value = True Then
Range("G26").Value = "Form B"
Else
Range("G26").Value = " "
End If
End Sub
在决定表单时,您需要检查另一个复选框的状态。像这样:
Private Sub check9_Click()
If check9.Value = True and check10.value = True Then
Range("G24").Value = "Form C"
ElseIf check9.Value = True and check10.Value = False Then
Range("G24").Value = "Form B"
ElseIf check9.Value = False and check10.Value = True Then
Range("G24").Value = "Form A"
End If
End Sub
Private Sub check10_Click()
If check9.Value = True and check10.value = True Then
Range("G24").Value = "Form C"
ElseIf check9.Value = True and check10.Value = False Then
Range("G24").Value = "Form B"
ElseIf check9.Value = False and check10.Value = True Then
Range("G24").Value = "Form A"
End If
End Sub
每次单击都调用此函数
public function FormNeeded()
if check9.value=true and check10.value=false then
range("g26").value="Form1"
elseif check9.value=false and check10.value=true then
range("g26").value="Form2"
elseif check9.value=true and check10.value=true then
range("g26").value="Form3"
end if
end function