-1

我正在使用 Excel 2011 执行以下查询:

WEB
1
http://careers.accel.com/careers_home.php?p=1

Selection=EntirePage
Formatting=All
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False

我想知道是否有一种方法可以遍历页面的值,即 URL 中的“p=1”自动增加到“p=2”。此外,此查询返回表格顶部的页码,我想知道是否有办法修改我的选择,以便只显示主表格。

Excel 渲染截图

4

1 回答 1

0

使用visual basic解决。但无法弄清楚删除页码:

' Macro2 Macro
'
For x = 1 To 5
Worksheets("names").Select
Worksheets("names").Activate
mystr = "URL;http://careers.accel.com/careers_home.php?p=1"
mystr = Cells(x, 1)
Worksheets("pages").Activate
'Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = x
'


 With ActiveSheet.QueryTables.Add(Connection:=mystr, Destination:=Range("$A" & Cells.SpecialCells(xlCellTypeLastCell).Row + 1))
        .PostText = "accel"
        .Name = False
        .FieldNames = False
        .RefreshStyle = xlInsertDeleteCells
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .HasAutoFormat = True
        .RefreshOnFileOpen = 1
        .BackgroundQuery = False
        .TablesOnlyFromHTML = True
        .SaveData = True
        .Refresh BackgroundQuery:=False
        .UseListObject = False


    End With
    Next x
End Sub
于 2014-08-26T15:12:23.130 回答