2

我希望宏在 C 列(在工作表“Tracker”上)从上到下运行,以查找与“Waiting”、“Deferred”、“New”或“Pending”文本匹配的任何单元格。

每次找到匹配项时,我都想在工作表“X”上运行一个带有地址的网络查询:

" http://efm/telecom/engineeringWorkOrders/viewEWOStatusLog.aspx?ewonumber= " + C 列匹配单元格中 A 列的对应值。

If (in Sheet "Tracker") Range("C" & CurRow).Value is "New" Then
    Run a web query in Sheet "X" (Starting in cell A1) with the address: "http://efm/telecom/engineeringWorkOrders/viewEWOStatusLog.aspx?ewonumber=" & Range("A" & CurRow).Value
4

1 回答 1

0

我对您的查询条件了解不多,因为您没有列出它们,但这将处理您的循环和输出需求:

Sub QueryIt()
    Dim CurRow As Long, LastRow As Long, DestRow As Long

    LastRow = Sheets("Tracker").Range("C" & Rows.Count).End(xlUp).Row
    For CurRow = 1 to LastRow
        If Sheets("Tracker").Range("C" & CurRow).Value = "New" Then
            DestRow = Sheets("X").Range("A" & Rows.Count).End(xlUp).Row + 1
            'Query command with address: "http://efm/telecom/engineeringWorkOrders/viewEWOStatusLog.aspx?ewonumber=" & Sheets("Tracker").Range("A" & CurRow).Value
            'Output query to Sheets("X").Range("A" & DestRow).Value
        End If
    Next CurRow
End Sub
于 2015-07-15T18:46:35.547 回答