ho due fogli, in foglio1 col. A ho una serie di link che mi permettono di scaricare delle tabelle di classifiche, nel foglio2 queste vengono sistemate nella col. A accodandole, sempre nella stessa colonna, a distanza di 2 righe dall'ultimo valore che trova nella col. A.
fin qui tutto ok, funziona perfettamente. ora però ho un'esigenza, devo far si che le tabelle (una per ogni link) vengano incolonnate sempre nella col. A ma in intervalli di celle esatti di 50 righe.
esempio:
1° link in cella A2
2° link in cella A52
3° link in cella A102
4° link in cella A152
ecc...
questo è il codice che utilizzo:
- Codice: Seleziona tutto
Sub link()
Dim xlCal As XlCalculation
Dim nextRow As Integer
Dim lastRow As Long
Dim URL As Range
Sheets("foglio2").Activate
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Shell "RunDll32.exe Inetcpl.cpl, ClearMyTracksByProcess 8"
lR = Sheets("foglio1").Cells(Rows.Count, "A").End(xlUp).Row - 1
For Each URL In Sheets("foglio1").Range("A1:A" & lR).Offset(1, 0).Rows
nextRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & URL, _
Destination:=Range("A" & nextRow + 2))
.WebFormatting = xlWebFormattingNone
.WebTables = "1"
.Refresh BackgroundQuery:=False
End With
Next
MsgBox " Completato"
End Sub
spero di essermi spiegato bene, grazie per l'aiuto.