|
楼主 |
发表于 2023-5-5 20:19
|
显示全部楼层
本帖最后由 sxo 于 2023-5-5 20:24 编辑
- <div class="blockcode"><blockquote>Dim Arr(), Brr(), crr()
- Dim drr As Variant
- Dim strarray() As Variant
- Set drr = Sheets("3¡′Îê±¼ä")
- strarray = drr.Range("A2:C16").Value
- Dim i%, j%, n%, m%, hm%, zs%, h% 'hm′ú±íË3DòoÅ£¬zs′ú±íÿ¸ö3¡′ÎèËêy
- hm = 1
- zs = 45
- Set D = CreateObject("scripting.dictionary")
- ReDim Brr(1 To 1070, 1 To 6)
- For i = 1 To UBound(strarray) '3¡′Î
- m = 0
- For j = 1 To 3 '¿¼3¡êy
- For h = 1 To zs '×ùλêy
- n = n + 1
- m = m + 1
- ' hm = hm + 1
- Brr(n, 1) = hm 'oÅ
- hm = hm + 1
- Brr(n, 2) = j '¿¼3¡
- Brr(n, 3) = i '3¡′Î
- Brr(n, 4) = IIf(m Mod zs, m Mod zs, zs) '×ùλoÅ
- Brr(n, 5) = strarray(i, 2)
- Brr(n, 6) = strarray(i, 3)
- D(Brr(n, 1)) = n 'óÃ×Öμä¼Ç¼¿¼oÅËùÔúμÄDDoÅ£¬¡±
- Next
- Next
- Next
- ' End With
- With Sheets("ѧéú±í")
- .Activate
- Arr = .Range("A2:A" & .Cells(.Rows.Count, 1).End(xlUp).Row).Value
- ReDim crr(1 To UBound(Arr), 1 To 5)
- For i = 1 To UBound(Arr)
- If D.Exists(Arr(i, 1)) Then
- n = D(CStr(Arr(i, 1)))
- For j = 2 To UBound(crr, 2) + 1
- crr(i, j - 1) = Brr(n, j)
-
- Next
- End If
- Next
- .[C2].Resize(UBound(crr), 5) = crr
- End With
复制代码
|
|