|
- Option Explicit
- Dim crr()
- Dim i%
- Sub l()
- Dim arr, brr
- Dim l%, str$, k$
- With Sheet1
- arr = .Range(.[a2], .[a2].End(4))
- End With
- ReDim crr(1 To UBound(arr), 1 To 18)
- For i = 1 To UBound(arr)
- str = Right(arr(i, 1), 1)
- If InStr(arr(i, 1), ",") Then
- brr = Split(arr(i, 1), ",")
- For l = 0 To UBound(brr)
- If InStr(brr(l), "-") Then
- Call zz(Split(brr(l), "-")(0), Split(brr(l), "-")(1))
- Else
- Call zz(brr(l), brr(l))
- End If
- Next
- ElseIf str = "单" Or str = "双" Then
- brr = Split(arr(i, 1), "-")
- If str = "单" Then k = "单" Else If str = "双" Then k = "双"
- Call zz(brr(0), Left(brr(1), Len(brr(1)) - 1), k)
- ElseIf InStr(arr(i, 1), "-") Then
- brr = Split(arr(i, 1), "-")
- Call zz(brr(0), brr(1))
- Else
- Call zz(arr(i, 1), arr(i, 1))
- End If
- Next
- Sheet1.[b2].Resize(UBound(arr), 18).Value = crr
- End Sub
- Sub zz(ByVal x As Integer, ByVal y As Integer, Optional ds = "")
- Dim j%
- For j = x To y
- If ds = "" Then
- crr(i, j) = 1
- ElseIf ds = "单" Then
- If (j Mod 2) = 1 Then crr(i, j) = 1
- ElseIf ds = "双" Then
- If (j Mod 2) = 0 Then crr(i, j) = 1
- End If
- Next
- End Sub
复制代码 |
|