- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub TEST()
Dim Brr, Crr, V, Y, R&, i&, j&, N&, T$, Tv
Dim xR As Range, Sh As Worksheet
Set Y = CreateObject("Scripting.Dictionary")
Set Sh = Sheets("5Y-Data")
Set xR = Intersect(Sh.[A1].CurrentRegion, Sh.UsedRange.Offset(2, 0))
Brr = xR
For i = 1 To UBound(Brr)
For j = 1 To UBound(Brr, 2) Step 2
T = Brr(i, j): Tv = Brr(i, j + 1)
If i = 1 Then T = "Date"
If T = "" Then GoTo i01
Y(T) = Y(T) + 1: Y(T & "|c") = j \ 2 + 1
Y(T & "|" & Y(T & "|c")) = Tv
If Y(T) = 6 Then R = R + 1
Next
i01:
Next
ReDim Crr(1 To R, 1 To 7)
For Each V In Y.keys
If Y(V) = 6 And InStr(V, "|") = 0 Then
N = N + 1: Crr(N, 1) = V
For j = 1 To 6
Crr(N, j + 1) = Y(V & "|" & j)
Next
End If
Next
With Sh.[O3].Resize(R, 7)
.EntireColumn.ClearContents
.Value = Crr
End With
Set Y = Nothing: Set xR = Nothing: Set Sh = Nothing: Erase Brr, Crr
End Sub |
|