|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
你的问题还真不少,自行测试…………- Sub tt() '个股信息提取
- Application.ScreenUpdating = False
- Dim lr&, ar, br(), a, b, d As Object, i%, c%, r&, cd$, st$, ymd$, k&
- Set d = CreateObject("scripting.dictionary")
- With Sheets("查看")
- cd = .[b3]
- lr = .Cells(Rows.Count, 2).End(xlUp).Row
- If lr > 3 Then
- If lr = 4 Then
- d(Trim(cd & Split(.[b4], ",")(0))) = ""
- Else
- ar = .Range("b4:b" & lr)
- For i = 1 To UBound(ar)
- If Len(ar(i, 1)) Then: ymd = Trim(Split(ar(i, 1), ",")(0)): d(cd & ymd) = ""
- Next
- End If
- End If
- End With
- a = Array(1, 27, 53)
- b = Array(2, 3, 5, 6)
- With Sheets("收盘数据")
- For i = UBound(a) To 0 Step -1
- ymd = Trim(.Cells(1, a(i)))
- If Not d.exists(cd & ymd) Then
- ar = .Cells(1, a(i)).CurrentRegion.Resize(, 6)
- For r = 3 To UBound(ar)
- st = ""
- If ar(r, 1) = cd Then
- k = k + 1
- ReDim Preserve br(1 To k)
- For c = 0 To UBound(b)
- st = st & "," & ar(r, b(c))
- Next
- br(k) = ymd & st
- End If
- Next
- End If
- Next
- End With
- If k Then Sheets("查看").Cells(Rows.Count, 2).End(xlUp).Offset(1).Resize(k) = WorksheetFunction.Transpose(br)
- Set d = Nothing
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|