Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel web query

Status
Not open for further replies.

halobender

Technical User
Mar 16, 2007
37
0
0
Hey all I have an issue and could use some extra brains.

Here is what I have..

I have a web query created in excel 2010 which has imported three columns and 500 rows

A = web hyperlink text
B = place
C = place

I need to find a way to use vba or the web query itself to visit the web hyperlink copy all text and paste back to column D

I am at a loss and have no code to even offer as everything I've tried has resulted in ultimate failure.
 
The query returned is in one column and is 10 rows

example query

1:You Name It - City
2:
3:####-A Major Hwy
4:City, State #####
5:
6:view map
7:(1669.3 miles away)
8:
9:phone: ###-###-####
10:Back

Ultimately and ideally I would just need rows 3, 4, and 9, and if I could get those to copy to the columns E, F, and G then I would be a major happy camper!!
 


Code:
Sub Main()
    Dim r As Range
    
    With [Expanded].Parent
        For Each r In [Expanded]
            queryedit r.Value
    'rows 3, 4, and 9, and if I could get those to copy to the columns E, F, and G
            .Cells(r.Row, "E").Value = Sheets("Test").Cells(3, "A")
            .Cells(r.Row, "F").Value = Sheets("Test").Cells(4, "A")
            .Cells(r.Row, "G").Value = Sheets("Test").Cells(9, "A")
        Next
    End With
End Sub

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
You my friend are brilliant!! works like a charm!!
 


We went thru a process of discovery, that can be reproduced in its essence in other situations, although the details of modification might need some expertise.

Glad it works for you.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I will try to put this to use on another project as well.. I understand the vb once its written and can edit it but as far as doing it all on my own thats another story
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top