【发布时间】:2016-05-12 03:21:36
【问题描述】:
我在网上找到了以下宏。 我想知道如何添加一个输入框,让我可以告诉宏检查 A 以外的其他列并从 A1 以外的其他单元格开始。
Sub Check_URLs()
Dim cell As Range
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
For Each cell In Range("A1", Range("A" & Rows.Count).End(xlUp))
If Left(cell.Value, 4) = "http" Then
' Goto web page
IE.Navigate cell.Text
Application.StatusBar = cell.Text & " is loading. Please wait..."
' Wait until web page is loaded
Do Until IE.ReadyState = 4 'READYSTATE_COMPLETE
Loop
Application.StatusBar = ""
' Look for text on web page
If InStr(IE.Document.body.innerText, _
"HTTP 404") > 0 Then
cell.Offset(, 1).Value = "zzz"
Else
cell.Offset(, 1).Value = "Y"
End If
End If
Next cell
IE.Quit
Set IE = Nothing
End Sub
【问题讨论】:
-
你试过上网吗?就像,谷歌“Inputbox Excel VBA”,我确定你会发现如何 :)