Public Sub subShowUserForm(strFormName As String)
Dim intNumOfForms As Integer
Dim intNumOfFormsCounter As Integer
intNumOfForms = UserForms.Count
If UserForms.Count > 0 Then
For intNumIfFormsCounter = 1 To intNumOfForms
If UserForms(intNumIfFormsCounter - 1).Name = strFormName Then
UserForms(intNumIfFormsCounter - 1).Show
Exit Sub
End If
Next
End If
End Sub
樓主 下述為依您要的結果設計~ 僅供參考~
這不是一個好的方式(針對市與區結合多的時候時,會寫很常)
請將程式碼貼到你需要的sheet中~
select 的 case 依您需要的笤整~
Private Sub Worksheet_Change(ByVal 變數 As Range)
If 變數.Row = 1 And 變數.Column = 3 And 變數 <> "" And 變數.Offset(1, 0) <> "" Then
A = 變數 & 變數.Offset(1, 0)
ElseIf 變數.Row = 2 And 變數.Column = 3 And 變數 <> "" And 變數.Offset(-1, 0) <> "" Then
A = 變數.Offset(-1, 0) & 變數
Else
Exit Sub
End If
Select Case A
Case "台南市中西區"
UserForm1.Show
Case "台南市東區"
UserForm2.Show
Case "台南市南區"
UserForm3.Show
End Select
End Sub作者: e123chen 時間: 2011-4-12 11:53