5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Excel 情報収集用マクロメモ1

Posted at

※記載内容はメモとして作成しているため、修正が必要な部分があるかもしれません。

####指定したWEBページから表をコピーするマクロ

With ActiveSheet.QueryTables.Add _
     (Connection:="URL;http://info.finance.yahoo.co.jp/ranking/?kd=1&tm=d&mk=1", _
     Destination:=Range("$B$8"))
             
    .WebSelectionType = xlSpecifiedTables
    .WebTables = "1"
             
    .WebFormatting = xlWebFormattingNone
    .WebPreFormattedTextToColumns = True
    
    .Refresh
     
End With

指定値
Connection              URL指定
Destination              貼り付け先指定
WebSelectionType = xlSpecifiedTables       webページ内の一部を取得する
WebTables = "1"              表1を指定、同ページ内で複数指定する場合は"1,2,3"と、要素番号を指定

テキスト形式を指定
WebFormatting = xlWebFormattingNone
WebPreFormattedTextToColumns = True

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?