|
原代码基础上改一下。
- Sub test()
- Dim Arr2, ar, arr1()
- Dim myr%, i%, j%, m%
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheet1
- ar = Range("a1:d45")
- ReDim arr1(1 To UBound(ar), 1 To 3)
- ReDim brr(1 To UBound(ar), 1 To 4)
- For i = 1 To UBound(ar)
- If Val(ar(i, 4)) = 0 And Val(ar(i, 2)) > 4.5 Then
- m = m + 1
- arr1(m, 1) = ar(i, 1) '代码
- arr1(m, 2) = ar(i, 3) '行业
- arr1(m, 3) = ar(i, 2) '涨幅%
- d(CStr(arr1(m, 2))) = ""
- End If
- Next i
- For i = 1 To UBound(ar)
- s = ar(i, 3)
- If d.exists(s) Then
- n = n + 1
- For j = 1 To UBound(ar, 2)
- brr(n, j) = ar(i, j)
- Next
- End If
- Next i
- .Range("f2").Resize(m, 3) = arr1
- .Columns(21).NumberFormatLocal = "@"
- .Range("u2").Resize(n, 4) = brr
- End With
- Application.ScreenUpdating = True
- 'Beep
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|