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

[µo°Ý] ¨Ï¥Î°}¦C¥N½X±a¤JªÑ²¼

[µo°Ý] ¨Ï¥Î°}¦C¥N½X±a¤JªÑ²¼

¦U¦ì«e½ú §Ú·Q­n§â°}¦C¥[¤J¸ê®Æ ,Åý9946¥i¥H±a¤J§Ú©Ò©w¸qªÑ²¼¦Cªí...
¦p¬õ¦â°Ï¶ô

9946-->¨ú¥N¦¨StockArr..

Dim StockArr As variable
StockArr = Array(9946,2330,2317,5522)'µ¥µ¥ªºªÑ²¼



Dim E As Object, i As Integer, ii As Integer, k As Integer
    Dim xadte As Date
    xadte = DateAdd("yyyy", -1, Date)  '¤é´Á(°_)¡G
    With CreateObject("InternetExplorer.Application")
        .Visible = True
        .Navigate "http://www.cnyes.com/twstock/intro/9946.htm"
        Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
        Set E = .document.getElementsByTAGName("TABLE")(4)
        ActiveSheet.UsedRange.Clear
        For i = 0 To E.Rows.Length - 1
            k = k + 1
            For ii = 0 To E.Rows(i).Cells.Length - 1
                Cells(k, ii + 1) = E.Rows(i).Cells(ii).INNERTEXT
            Next
        Next
        .Quit        'Ãö³¬ºô­¶
    End With
   
    Dim yadte As Date
    yadte = DateAdd("yyyy", -1, Date)  '¤é´Á(°_)¡G
    With CreateObject("InternetExplorer.Application")
        .Visible = True
        .Navigate "http://pchome.megatime.com.tw/stock/9946.html"
        Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
        Set E = .document.getElementsByTAGName("TABLE")(4)
        For i = 0 To E.Rows.Length - 1
            k = k + 1
            For ii = 0 To E.Rows(i).Cells.Length - 1
                Cells(k, ii + 1) = E.Rows(i).Cells(ii).INNERTEXT
            Next
        Next
        .Quit        'Ãö³¬ºô­¶
    End With
       
       
        Dim R As Range, Rng As Range
    For Each R In ActiveSheet.Range("A:A").SpecialCells(xlCellTypeConstants).Rows
    'ActiveSheet(§@¥Î¤u§@ªí) SpecialCells(xlCellTypeConstants "¥]§t±`¼ÆªºÀx¦s®æ")
         If Not IsError(Application.Match("¬ÛÃöÅvÃÒ", R, 0)) Then
            '¤u§@ªí¨ç¼ÆMatch ´M§ä¨ì0 ¶Ç¦^¼Æ¦r,§ä¤£¨ì0 ¶Ç¦^¿ù»~­È #N/A
            If Rng Is Nothing Then Set Rng = R Else Set Rng = Union(R, Rng)
            'Union ¤èªk ¶Ç¦^¨â­Ó©Î¦h­Ó½d³òªº¦X¨Ö½d³ò¡C
        End If
   Next
   If Not Rng Is Nothing Then Rng.EntireRow.Delete   '½d³ò¾ãÄæ§R°£

2014-12-28-Stock.rar (20.2 KB)

¦^´_ 1# s13983037
¥i¨Ì¤U¦¡°Ñ·Ó­×§ï :
  1. Dim StockArr, v
  2. StockArr = Array(9946, 2330, 2317, 5522) 'µ¥µ¥ªºªÑ²¼
  3. For Each v In StockArr
  4.   Debug.Print "http://www.cnyes.com/twstock/intro/" & v & ".htm"
  5. Next
½Æ»s¥N½X

TOP

¦^´_ 1# s13983037
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Private Sub CommandButton1_Click()
  3.     Dim E As Object, i As Integer, ii As Integer, k As Integer
  4.     Dim StockArr(), A As Variant, Sh As Worksheet
  5.     StockArr = Array(9946, 2330, 2317, 5522) 'µ¥µ¥ªºªÑ²¼
  6.     Set Sh = ActiveSheet
  7.     Sh.UsedRange.Clear
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Visible = True
  10.         k = 1
  11.         For Each A In StockArr
  12.             .Navigate "http://www.cnyes.com/twstock/intro/" & A & ".htm"
  13.             Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  14.             Sh.Cells(k, 1) = Split(.document.Title, "_")(0)  'ªÑ²¼:¦WºÙ¥N¸¹
  15.             Set E = .document.getElementsByTAGName("TABLE")(4)
  16.             For i = 0 To E.Rows.Length - 1
  17.                 k = k + 1
  18.                 For ii = 0 To E.Rows(i).Cells.Length - 1
  19.                     Sh.Cells(k, ii + 1) = E.Rows(i).Cells(ii).INNERTEXT
  20.                 Next
  21.             Next
  22.             '**************************************************************
  23.            .Navigate "http://pchome.megatime.com.tw/stock/sid" & A & ".html"
  24.             Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  25.             Set E = .document.getElementsByTAGName("TABLE")(4)
  26.             For i = 0 To E.Rows.Length - 1
  27.                 k = k + 1
  28.                 For ii = 0 To E.Rows(i).Cells.Length - 1
  29.                     Sh.Cells(k, ii + 1) = E.Rows(i).Cells(ii).INNERTEXT
  30.                 Next
  31.             Next
  32.             k = k + 2
  33.         Next
  34.         .Quit        'Ãö³¬ºô­¶
  35.     End With
  36.     With Sh.Range("a:a")
  37.         .Replace "¬ÛÃöÅvµý", "=500/0"   '²£¥Í¿ù»~ªº¤½¦¡
  38.         If Not .Find("#DIV/0!", LookIn:=xlValues) Is Nothing Then
  39.             .SpecialCells(xlCellTypeFormulas, xlErrors).EntireRow.Delete
  40.         End If
  41.     End With
  42. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 3# GBKEE

GBKEE «e½ú§A¦n
§Ú·Q¦b¥[¤W¤@­Ó°}¦Cªí,·íÀx¦s®æ¦³§ä¨ìArrayªº²M³æ´N§â¸ÓROW§R°£..
Array = {º¦¶^,¥»¯q¤ñ,¦P·~,¥­§¡¥»¯q¤ñ,Á`¥«­È,§ë¸ê³ø¹S²v,¤µ¦~¥H¨Ó,³Ìªñ¤@¶g,³Ìªñ,¤@­Ó¤ë}
ªþ¤W¥t¤@­ÓÀÉ®×....

¦A³Â·Ð±z¤F...«D±`·PÁÂ...

Stock_20141229.rar (21.02 KB)

TOP

¦^´_ 4# s13983037

½Ð¦Û¦æ±a¤J§Aªºµ{¦¡
  1. '**************************************************************
  2.             .Navigate "http://jsjustweb.jihsun.com.tw/z/zc/zcx/zcx_" & A & ".asp.htm"
  3.             Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  4.             Set E = .document.getElementsByTAGName("TABLE")(12)
  5.             For i = 10 To E.Rows.Length - 1   '*** ¬D¿ï§A­nªº¸ê®Æ***
  6.                 k = k + 1
  7.                 For ii = 0 To E.Rows(i).Cells.Length - 1
  8.                 Debug.Print i, E.Rows(i).Cells(ii).INNERTEXT  '¥i±oª¾§A­nªº¸ê®Æ ¦b­þ¤@­ÓRows¤¤
  9.                     Sh.Cells(k, ii + 1) = E.Rows(i).Cells(ii).INNERTEXT
  10.                 Next
  11.             Next
  12.             k = k + 2
  13.         Next
  14.         .Quit        'Ãö³¬ºô­¶
  15.     End With
  16.     '/////// ¦³¬D¿ï§A­nªº¸ê®Æ³o¬qªºµ{¦¡½X¥i¥H¤£­n¤F
  17.     With Sh.Range("a:a")
  18.         .Replace "¬ÛÃöÅvµý", "=500/0"   '²£¥Í¿ù»~ªº¤½¦¡
  19.         If Not .Find("#DIV/0!", LookIn:=xlValues) Is Nothing Then
  20.             .SpecialCells(xlCellTypeFormulas, xlErrors).EntireRow.Delete
  21.         End If
  22.     End With
  23.     '////////////////////////////////////////////////
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 5# GBKEE


    ·PÁÂGBKEE¤j¤j !! §Ú¤w¸g¥[¤Jµ{¦¡½X¤¤¤F ·PÁ±zªº¤j¤OÀ°¦£

TOP

        ÀR«ä¦Û¦b : ­n¤ñ½Ö§ó¨ü½Ö¡D¤£­n¤ñ½Ö§ó©È½Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD