你好大师!
昨天的指点我试过了,关闭代码编辑器也不行,在代码有问题时也关不了,很麻烦。
代码分割成函数,帮助里面关于函数的介绍我还理解不透,下面是一段完整的case代码,想请大师看看能不能分割,帮我分割一下,谢谢
Case ("leixing10")
Dim a As String="23579"
Dim b As String=e.Row("wan")
Dim c As String=e.Row("qian")
Dim d As String=e.Row("bai")
Dim g As String=e.Row("shi")
Dim f As String=e.Row("ge")
Dim y As Boolean=True
Dim z As Boolean=False
If a.contains(b)=y And a.contains(c)=y And a.contains(d)=y And a.contains(g)=z And a.contains(f)=z Then
e.Row("leixing10")= "01"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500 Step 1
If Tables("五星5").Rows(h-sum)("leixing10")="01"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=y And a.contains(d)=z And a.contains(g)=y And a.contains(f)=z Then
e.Row("leixing10")= "03"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="03"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=y And a.contains(d)=z And a.contains(g)=z And a.contains(f)=y Then
e.Row("leixing10")= "05"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="05"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=z And a.contains(d)=y And a.contains(g)=y And a.contains(f)=z Then
e.Row("leixing10")= "07"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="07"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=z And a.contains(d)=y And a.contains(g)=z And a.contains(f)=y Then
e.Row("leixing10")= "09"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="09"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=z And a.contains(d)=z And a.contains(g)=y And a.contains(f)=y Then
e.Row("leixing10")= "11"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="11"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=y And a.contains(d)=y And a.contains(g)=y And a.contains(f)=z Then
e.Row("leixing10")= "13"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="13"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=y And a.contains(d)=y And a.contains(g)=z And a.contains(f)=y Then
e.Row("leixing10")= "15"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="15"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=y And a.contains(d)=z And a.contains(g)=y And a.contains(f)=y Then
e.Row("leixing10")= "17"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="17"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=z And a.contains(d)=y And a.contains(g)=y And a.contains(f)=y Then
e.Row("leixing10")= "19"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="19"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=y And a.contains(d)=y And a.contains(g)=y And a.contains(f)=y Then
e.Row("leixing10")= "21"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="21"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=z And a.contains(d)=y And a.contains(g)=y And a.contains(f)=y Then
e.Row("leixing10")= "23"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="23"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=y And a.contains(d)=z And a.contains(g)=y And a.contains(f)=y Then
e.Row("leixing10")= "25"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="25"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=y And a.contains(d)=y And a.contains(g)=z And a.contains(f)=y Then
e.Row("leixing10")= "27"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="27"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=y And a.contains(d)=y And a.contains(g)=y And a.contains(f)=z Then
e.Row("leixing10")= "29"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="29"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=y And a.contains(d)=y And a.contains(g)=y And a.contains(f)=y Then
e.Row("leixing10")= "31"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="31"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=z And a.contains(d)=z And a.contains(g)=y And a.contains(f)=y Then
e.Row("leixing10")= "02"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="02"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=z And a.contains(d)=y And a.contains(g)=z And a.contains(f)=y Then
e.Row("leixing10")= "04"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 250
If Tables("五星5").Rows(h-sum)("leixing10")="04"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=z And a.contains(d)=y And a.contains(g)=y And a.contains(f)=z Then
e.Row("leixing10")= "06"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="06"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=y And a.contains(d)=z And a.contains(g)=z And a.contains(f)=y Then
e.Row("leixing10")= "08"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="08"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=y And a.contains(d)=z And a.contains(g)=y And a.contains(f)=z Then
e.Row("leixing10")= "10"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="10"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=y And a.contains(d)=y And a.contains(g)=z And a.contains(f)=z Then
e.Row("leixing10")= "12"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="12"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=z And a.contains(d)=z And a.contains(g)=z And a.contains(f)=y Then
e.Row("leixing10")= "14"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="14"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=z And a.contains(d)=z And a.contains(g)=y And a.contains(f)=z Then
e.Row("leixing10")= "16"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="16"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=z And a.contains(d)=y And a.contains(g)=z And a.contains(f)=z Then
e.Row("leixing10")= "18"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="18"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=y And a.contains(d)=z And a.contains(g)=z And a.contains(f)=z Then
e.Row("leixing10")= "20"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="20"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=y And a.contains(c)=z And a.contains(d)=z And a.contains(g)=z And a.contains(f)=z Then
e.Row("leixing10")= "22"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="22"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=y And a.contains(d)=z And a.contains(g)=z And a.contains(f)=z Then
e.Row("leixing10")= "24"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="24"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=z And a.contains(d)=y And a.contains(g)=z And a.contains(f)=z Then
e.Row("leixing10")= "26"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="26"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=z And a.contains(d)=z And a.contains(g)=y And a.contains(f)=z Then
e.Row("leixing10")= "28"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="28"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=z And a.contains(d)=z And a.contains(g)=z And a.contains(f)=y Then
e.Row("leixing10")= "30"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="30"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
Else If a.contains(b)=z And a.contains(c)=z And a.contains(d)=z And a.contains(g)=z And a.contains(f)=z Then
e.Row("leixing10")= "32"
Dim sum As Integer
Dim h As Integer=e.Row.Index
If h<>0 And h-sum>0 Then
For sum=1 To 500
If Tables("五星5").Rows(h-sum)("leixing10")="32"
e.Row("yilou10")=sum
Exit For
End If
Next
End If
End If