我有一个工作簿,通过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,或者如果在指定时间内有多个项目,则显示列表。最终我需要一个消息框来显示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
先谢谢。
答案 0 :(得分:0)
试试这个,我不知道它是否有帮助但是有。
MyVariable = Range("D25, D28, D31, D34, D37")
for each Mycell in MyVariable
if MyCell.Value > 0 then
..... 'your code
next Mycelll