Cómo hacer un loop que copie URL's de un rango de celdas para hacer muchas consultas web
Hola a todos,
Estoy tratando de hacer una macro con un que agarre de un rango de celdas muchos URL'S y que los vaya utilizando para hacer consultas e importar datos. Mas o menos he escrito lo siguiente pero no me ha funcionado:
Sub webquery()
startrow = 1
For i = 1 To 3
curl = ActiveSheet.Cells(i,10) <------ ahí es dónde tengo la lista de URL's
With ActiveSheet.QueryTables.Add(Connection:=curl, Destination:=Range("$A$" & startrow))
.Name = "Webquery" & i
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "3"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
startrow = startrow + 56
Next i
End Sub
Lo intenté haciendo al principio
if i=1 Then
curl="......."
if i=2 Then
Pero la verdad es que son muchos links y es muy difícil hacerlo así