ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¤Wºô§ìªÑ²¼¸ê®Æ

¦^´_ 5# chairles59
¯÷±N GBKEE ª©¤jµ¹§Aªº´£¥Ü¾ã²z¨Ãµy¥[­×¥¿¡A
¨ä¹ê GBKEE ª©¤j¤w¸g«ü¤Þ¥X§Aªº°ÝÃD©Ò¦b¡C
  1. Sub Ex()
  2.     Dim po As Integer                  '  «Å§i PO ¬°¾ã¼Æ
  3.    
  4.     lR = Range("A2").End(xlDown).Row      '  R = 9 : Variant/Long
  5.     Rows(lR + 1 & ":400").Clear                    '  ª½±µ²M°£Àx¦s®æ,¤£¥² Select ¦A§R°£
  6.     '  Selection.Delete shift:=xlUp
  7.    
  8.     LRA = Range("B2").End(xlDown).Row  '  LRA = 9 : Variant/Long

  9.     For i = 3 To LRA
  10.         '  If Cells(i, 3) <> "" Then    ' ¤u§@ªí C Äæ ,¨S¦³¶R¶i¤é´Á,©Ò¥H¤£·|°õ¦æ¶×¤J¸ê®Æªºµ{¦¡½X
  11.         If Cells(i, 3) = "" Then        ' ­×¥¿¬°ªÅ­È®É©l¶i¦æ¸ê®Æ¶×¤J
  12.             Valuesno = "$A$" & i
  13.             Linkss = "URL;https://tw.stock.yahoo.com/q/q?s=" & Cells(i, 1)
  14.         
  15.             po = lR - 5 + (7 * (i - 2)) '  ©w§ì¨ú¸ê®Æªí®æ°j°é

  16.             With ActiveSheet.QueryTables.Add(Connection:= _
  17.                                 Linkss, Destination:=ActiveSheet.Range("B" & po))
  18.                 .FieldNames = True
  19.                 .RowNumbers = False
  20.                 .FillAdjacentFormulas = False
  21.                 .PreserveFormatting = True
  22.                 .RefreshOnFileOpen = False
  23.                 .BackgroundQuery = True
  24.                 .RefreshStyle = xlInsertDeleteCells
  25.                 .SavePassword = False
  26.                 .SaveData = True
  27.                 .AdjustColumnWidth = True
  28.                 .RefreshPeriod = 0
  29.                 .WebSelectionType = xlSpecifiedTables
  30.                 .WebFormatting = xlWebFormattingNone
  31.                 .WebTables = "6"
  32.                 .WebPreFormattedTextToColumns = True
  33.                 .WebConsecutiveDelimitersAsOne = True
  34.                 .WebSingleBlockTextImport = False
  35.                 .WebDisableDateRecognition = False
  36.                 .WebDisableRedirections = False
  37.                 .Refresh BackgroundQuery:=False
  38.                 .Name = .ResultRange.Cells(3, 1)
  39.             End With
  40.             
  41.             Range("A" & po + 2) = Cells(i, 1)
  42.             '  Cells(i, 2) = "=vlookup(" & Cells(i, 1) & ",$A$16:$O$200,2,0)"    '  ¬O­^¤å¦r¥À O,¤£¬O¼Æ¦r 0
  43.             Cells(i, 2) = "=vlookup(" & Cells(i, 1) & ",$A$11:$O$200,2,0)"       '  ±q $A$16 °_©l¤§½d³ò·|³y¦¨ B3 ±o¥X¤£¥¿½T­È
  44.             Cells(i, 2) = Mid(Cells(i, 2).Text, 5)                               '  Mid(Cells(i, 2), 5) ·|²£¥Í°õ¦æ¶¥¬q¿ù»~ 13 «¬ºA¤£²Å
  45.             
  46.             '  Cells(i, 7) = "=vlookup(" & Cells(i, 1) & ",$A$16:$O$200,4,0)"    '  ¬O­^¤å¦r¥À O,¤£¬O¼Æ¦r 0
  47.             Cells(i, 7) = "=vlookup(" & Cells(i, 1) & ",$A$11:$O$200,4,0)"       '  ±q $A$16 °_©l¤§½d³ò·|³y¦¨ G3 ±o¥X¤£¥¿½T­È
  48.         End If
  49.     Next
  50. End Sub
½Æ»s¥N½X

TOP

¦^´_ 5# chairles59

TOP

        ÀR«ä¦Û¦b : ¬O«D·í±Ð¨|¡AÆg¬ü§@ĵ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD