Problems with XMLImport (Range and relative references)

tesAR

New Member
Joined
Feb 10, 2015
Messages
1
Hi,

I've got some problems in designing a macro. As my VBA knowledge is very limited, I'm looking for an easy solution, that I am able to understand.

Idea: I've got a list of 10.000 URLs which are aligned one below the other. Each of those URLs is supposed to be used with XMLImport in the adjacent cell. This will produce entries in the 15 adjacent cells (within the row only).

At the moment, I am stuck with this. I highlighted my specific problems:

Sub Makro1()
'
' Makro1 Makro
'


'
ActiveCell.Offset(0, -1).Range("Tabelle28[[#Headers],[version]]").Select
ActiveCell.FormulaR1C1 = _
"http://URL.com/1"
ActiveCell.Offset(0, 1).Range("Tabelle28[[#Headers],[version]]").Select
ActiveWorkbook.XmlImport URL:= _
"http://URL.com/1", _
ImportMap:=Nothing, Overwrite:=True, Destination:=Range("N1")
ActiveWindow.SmallScroll Down:=-6
ActiveCell.Offset(1, 0).Range("Tabelle28[[#Headers],[version]]").Select
End Sub

1. As you can see, only the first (/1 of /10000) URL (from M1) is used and pasted in N1. So, if I change the Range to N3, again only the first URL will be pasted in N3 etc. because that URL is used as plain text obviously. However, I'd like for the macro to copy each URL adjacent to the selected cell and use it with XmlImport in that selected cell.

2. When I start the macro, the URL is processed in N1 only. But, I'd like data output to appear in each cell next to the URLs. URL /3 would be processed in N3, etc.. So, I'd need some sort of relative Range.

For now, I'd be happy with a macro that only processes one URL at the time and then jumps to the next cell, so I could start the macro again. I don't need a loop (just yet), because I want to understand the solutions to my problems first and keep it simple. If I suceed with that, I'd like to try to find a solution for the loop myself before asking for advice again.

Help would be very much appreciated.

Regards.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,215,052
Messages
6,122,878
Members
449,097
Latest member
dbomb1414

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