標題:
[發問]
請問如何從網路上抓下資料存入excel後"列"不會動
[打印本頁]
作者:
cji3cj6xu6
時間:
2013-7-20 10:27
標題:
請問如何從網路上抓下資料存入excel後"列"不會動
假設以下第一筆存入A80,第二筆存入A100,但第一筆的資料會被推到M80,請問要如何修改。
謝謝!
Sub 新增查詢()
Range("A80").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://tw.stock.yahoo.com/q/q?s=1101", Destination:=Selection)
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "3"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
.Name = .ResultRange.Cells(1, 1)
End With
Range("A100").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://tw.stock.yahoo.com/q/q?s=1101", Destination:=Selection)
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "6"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
.Name = .ResultRange.Cells(3, 1)
End With
作者:
GBKEE
時間:
2013-7-20 14:55
回復
1#
cji3cj6xu6
With ActiveSheet.QueryTables.
Add
-> 新增查詢,如Range("A80")有[查詢],會被一直往工作表的右邊移動(
不會被覆蓋
)
With ActiveSheet.QueryTables(??) -> 第??個外部查詢 ,就不會動到其它的外部查詢.
作者:
cji3cj6xu6
時間:
2013-7-20 22:14
又麻煩您了GBKEE大,
原來是修改此處,謝謝G大。
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)