消息导航到单元格值提供的网站



我有一个工作簿,收集数据通过SQL查询从一个网站上显示的数据库。查询收集当前和显示在提供URL和发布时间的表中的数据(这些列:URL和时间),有了这些信息,我有一个单元格(B25 B28和其他),它使用=countif公式收集表中的所有项目以及哪些项目已经过了一定时间。

的例子:

=COUNTIFS(table_name[URL Column Name],"Items underneath said Column",table_name[Time Column],">"&NOW()-0.167)

我试图在工作表中创建一个具有此信息的VBA脚本,启动该公式读取的单元格提供的URL,或显示一个列表,如果在分配的时间内有超过1个项目。最后,我需要一个消息框来显示URL。

到目前为止,我有这个作为我的VBA代码:
Private Sub Worksheet_Calculate()
    Dim lResponse As Long
    Set ie = CreateObject("InternetExplorer.Application")
    Application.EnableEvents = False
    If Me.Range("D25, D28, D31, D34, D37").Value > 0 Then
        lResponse = MsgBox("my message for yes or no?", vbQuestion + vbYesNo,     "box title")
        If lResponse = vbYes Then
            ie.Navigate(" & Me.Range &").Value
        Else
            Exit Sub
        End If
    End If
    Application.EnableEvents = True
End Sub

试试这个,我不知道它是否有帮助,但是有。

MyVariable = Range("D25, D28, D31, D34, D37")
for each Mycell in MyVariable
    if MyCell.Value > 0 then
    ..... 'your code
next Mycelll

最新更新