Board logo

標題: 此網頁匯入excel, 巨集要怎麼改?? [打印本頁]

作者: t8899    時間: 2013-12-6 10:40     標題: 此網頁匯入excel, 巨集要怎麼改??

WEB
1
http://stock.chinatimes.com/asp/hot/ShortOperate.asp?lcount=30&m=puplim&align=v

Selection=7,11  ===========>不對!???
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
--------------------------------------
With Sheets("漲跌停")
                .Cells = ""
                .Cells(1, 1) = "漲停鎖死股"
                For Each i In Array(7, 11)
                    If i = 24 Then .Cells(1, "J") = "跌停鎖死股"
                    Y = 2
                    For R = 0 To xlVbTable(i).Rows.Length - 1
                        For C = 0 To xlVbTable(i).Rows(1).ALL.Length - 1
                            .Cells(Y, C + IIf(i = 5, 1, 10)) = xlVbTable(i).Rows(R).Cells(C).innerText
                            'IIf(i = 5, 1, 10) ->  1:="A", 10:="J"
                        Next
                        Y = Y + 1
                    Next
                    If i = 5 Then .Rows(13).Delete   '貼上連結的儲存格仍然是#REF!->儲存格被刪除掉
      
            End With
作者: t8899    時間: 2013-12-6 15:18

本帖最後由 t8899 於 2013-12-6 15:19 編輯

試了30分才試出來  :-(
With Sheets("漲跌停")
                .Cells = ""
                .Cells(1, 1) = "漲停鎖死股"
                For Each i In Array(6, 10)
                    If i = 10 Then .Cells(1, "J") = "跌停鎖死股"
                    Y = 2
                    For R = 0 To xlVbTable(i).Rows.Length - 1
                        For C = 0 To xlVbTable(i).Rows(1).ALL.Length - 1
                            .Cells(Y, C + IIf(i = 6, 1, 10)) = xlVbTable(i).Rows(R).Cells(C).innerText
                            'IIf(i = 6, 1, 10) ->  1:="A", 10:="J"
                        Next
                        Y = Y + 1
                    Next
                    If i = 6 Then .Rows(13).Delete  
                    If i = 6 Then .Rows(24).Delete
                 
                Next
            End With




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)