根据单元格值创建查询 table

Create Query table based on cell value

我希望宏在 C 列(在 Sheet "Tracker" 上)从上到下 运行 以找到与 "Waiting"、"Deferred"、"New" 或 "Pending" 文本。

每次它找到一个匹配项时,我想 运行 在 Sheet "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

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

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