
Originally Posted by
Chipless
Thanks for the response. How would I loop through the range? The web query uses the zip code in cell B1, and places that zip code at the end of a URL string that it queries. So, if I set the query to lookup a range instead of a single cell, it ends up trying to pull an invalid URL

This is pretty basic but may help explain. And probably better to set a Named Range of the ZipCode Column. But the below should help in understanding how to set a range for the zipcode column, loop through it, and append the zip code value to your url.
Sub LoopZips()
Dim rCell, Zips As Range
Dim WQuery As String
WQuery = "http://www.mywebquery.com?zipcode="
Set Zips = Range("C2:C10")
For Each rCell In Zips
MsgBox WQuery & rCell.Value
'Put the Crime Rates 2 cells right
rCell.Offset(0, 2).Value = "Violent Crime Info"
rCell.Offset(0, 3).Value = "Property Crime Info"
Next rCell
End Sub
You can also probably get some better help in VBA forum, or maybe a Mod can shift this topic there. And any sample code or file would be helpful too.
Bookmarks