整整一周,我与几个具有 VB 经验的人一起工作,但我们无法让所有这些 If / Then 语句正常工作。除引用“otype”+ SCE+ CNE 和“otype”= 专线或仅 Internet 的语句外,所有语句均有效。逻辑似乎是正确的,但我们没有得到预期的结果。帮助!下面是我们有疑问的VB代码。谢谢你。
Private Sub Worksheet_Activate()
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Rem CNE Customer
If Range("otype") = "SCE+ CNE" Then
Worksheets("VNC Form").Visible = True
Worksheets("ISC Portal").Visible = True
Worksheets("ISC Request Only").Visible = False
Worksheets("VPN Details").Visible = False
Else
Worksheets("VNC Form").Visible = False
Worksheets("ISC Portal").Visible = False
End If
Rem ISM ABC Customer
If Range("otype") = "SC4ABC" Then
Worksheets("ISM-ABC Customers").Visible = True
Worksheets("ISM Portal").Visible = True
Else
Worksheets("ISM-ABC Customers").Visible = False
End If
Rem VPN Details tab
If Range("ctype") = "VPN" Then
Worksheets("VPN Details").Visible = True
Worksheets("ISC Portal").Visible = True
Worksheets("VNC Form").Visible = False
Else
Worksheets("VPN Details").Visible = False
Worksheets("ISC Portal").Visible = False
Worksheets("VNC Form").Visible = False
End If
Rem Connections tabs
If Range("ctype") = "Dedicated Line" Or Range("ctype") = "Internet Only" Then
Worksheets("ISC Portal").Visible = True
Worksheets("VPN Details").Visible = False
Else
Worksheets("ISC Portal").Visible = False
Worksheets("VPN Details").Visible = False
End If
Rem AT&T and Connection tabs
If Range("otype") = "SCE+ Reseller" And Range("ctype") = "CNE" Or Range("otype") = "SCE+ Internal" And Range("ctype") = "CNE" Then
Worksheets("ISC Request Only").Visible = True
Worksheets("VNC Form").Visible = True
Worksheets("ISC Portal").Visible = False
Worksheets("VPN Details").Visible = False
Else
Worksheets("ISC Request Only").Visible = False
Worksheets("VNC Form").Visible = False
Worksheets("ISC Portal").Visible = True
Worksheets("VPN Details").Visible = True
End If
End Sub