VBA taking values from cells question

Reshaw

Board Regular
Joined
Mar 2, 2011
Messages
53
Hi there

I have written a web query to fetch information from a web page containing company address details. Each company has its own sub-page with a predictable URL, such that I now have a list of these urls for each company in question and these are arranged into a single row on my worksheet.

I have then used the web query wizard to fetch all the data from a given page and it pastes it as a column with the first cell being the one immediately below the cell with the URL in it. Nice so far.

What I want to do is write a macro such that I can loop this web query to do the same job for each URL.

I have an integer variable (RS_X) that increments each cycle which essentially counts the horizontal position from the left.

I am having trouble getting the web query code to directly address a cell value however.

So far I have:

Code:
With ActiveSheet.QueryTables.Add(Connection:= ActiveSheet.Cells(3, RS_X).Value, Destination:=ActiveSheet.Cells(4, RS_X).Range)

                   /* Removed Query filter info  */


    End With

This produces the error "wrong number of arguments or invalid property assignment". I don't know what that means exactly.



Now I am reasonably proficient at excel but a relative n00b with VBA. So if there are some glaringly obvious coding errors, please point them out, they are not obvious to me!

If I am going about this the wrong way then please advise an alternative method if more appropriate.

Thanks in advance
Robin
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top