- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¦^´_ 1# icestormer
VBAProject
¥D¤u§@ªí- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- If Application.Intersect(Target, Range("F1:G1")) Is Nothing Then Exit Sub
- UpdatePrice
- End Sub
½Æ»s¥N½X ¤@¯ë¼Ò²Õ- Sub UpdatePrice()
- Dim d, rng As Range
- Dim sName As String, sSell As String, sBuy As String
- Dim r As Long, c As Long, x
-
- Const sMark = " - Market Browser"
- Const sMarkSell = "Sell Orders (Buy Orders)"
- Const sMarkBuy = "Buy Orders"
-
- Set d = CreateObject("scripting.dictionary")
-
- With Sheets("¸ê®Æ°Ï")
- For c = 1 To .UsedRange.Columns.Count Step 7 '6Äæ¥[¤WªÅ¥ÕÄæ = 7
- For r = 1 To .Cells(.Rows.Count, c).End(xlUp).Row Step 300 '©T©w300¦C
- sName = "": sSell = "": sBuy = ""
- With .Cells(r, c).Resize(300)
- Set rngName = .Find(sMark, LookIn:=xlValues, lookat:=xlPart)
- If rngName Is Nothing Then GoTo NEXT_BLOCK Else sName = Left(rngName.Value, Len(rngName.Value) - Len(sMark))
-
- Set rng = .Find(sMarkSell, LookIn:=xlValues, lookat:=xlWhole)
- If Not rng Is Nothing Then sSell = rng.Offset(3, 2).Value
-
- Set rng = .Find(sMarkBuy, LookIn:=xlValues, lookat:=xlWhole)
- If Not rng Is Nothing Then sBuy = rng.Offset(3, 2).Value
-
- d(sName) = Array(sSell, sBuy)
- End With
- NEXT_BLOCK:
- Next
- Next
- End With
-
- '¶K¤W»ù¦ì
- With Sheets("¥D¤u§@ªí")
- For Each x In .Range(.Range("A2"), .Cells(.Rows.Count, "A").End(xlUp))
- If d.exists(x.Value) Then x.Offset(, 1).Resize(, 2).Value = d(x.Value)
- Next
- End With
- End Sub
½Æ»s¥N½X |
|