|
- Sub lqxs()
- Dim Arr, i&, x, y, kk, tt, j&, aa
- Dim d, k, t, b, m&, Brr
- Set d = CreateObject("Scripting.Dictionary")
- Sheet2.Activate
- [a2:e50000].ClearContents
- [a2:e50000].Borders.LineStyle = xlNone
- nf = 2015: yf = 8
- dd = Day(DateSerial(nf, yf + 1, 0))
- Arr = Sheet1.[a1].CurrentRegion
- For i = 2 To UBound(Arr)
- x = Arr(i, 1) & "," & Arr(i, 2): rq = Arr(i, 3)
- rq = Left(rq, Len(rq) - 1)
- b = Split(rq, "-")
- y = DateSerial(b(0), b(1), b(2))
- If d.exists(x) = False Then Set d(x) = CreateObject("Scripting.Dictionary")
- d(x)(y) = d(x)(y) & Arr(i, 4) & " "
- Next
- k = d.keys: t = d.items
- For i = 0 To UBound(k)
- kk = t(i).keys: tt = t(i).items
- m = Cells(Rows.Count, 1).End(xlUp).Row + 1
- Cells(m, 1).Resize(dd, 1) = k(i)
- For j = 1 To dd
- Cells(m + j - 1, 3) = DateSerial(nf, yf, j)
- Cells(m + j - 1, 4) = Format(Cells(m + j - 1, 3).Value, "[$-804]aaaa")
- Next
- Brr = Cells(m, 1).Resize(dd, 3)
- For j = 1 To UBound(Brr)
- x = Brr(j, 1): y = Brr(j, 3)
- If d(x).exists(y) Then Cells(m + j - 1, 5) = d(x)(y)
- Next
- Next
- m = Cells(Rows.Count, 1).End(xlUp).Row
- [a2].Resize(m - 1, 1).TextToColumns DataType:=xlDelimited, Comma:=True
- [a1].CurrentRegion.Borders.LineStyle = 1
- End Sub
复制代码 |
|