
http://www.fileden.com/files/2010/4/1/2813746//A1.xlsm
Moderatori: Anthony47, Flash30005
"URL;http://www.borsaitaliana.it/borsa/azioni/contratti.html?isin=" & MyIsin & "&" & Pag2 _
Sub QWloop()
For N = 1 To 23 '<<< QUANTE SONO le pagine da prelevare
NewConn = "URL;http://www.xxxxx.yy.zz/.../category.aspx?&Page=" & N & "&Sort=1&catid=14267"
NewDest = Range("B" & Rows.Count).End(xlUp).Offset(1, -1).Address
ActiveSheet.QueryTables(1).Connection = NewConn
ActiveSheet.QueryTables(1).Destination = Range(NewDest)
ActiveSheet.QueryTables(1).Refresh
Next N
End Sub
Infatti ho usato il metodo .Destination che pero' e' di sola letturaHo seguito la tua spiegazione ma noto che tutte le pagine importate si sovrascrivono e solo l'ultima rimane visibile nel foglio
Sub QWloop()
For N = 1 To 23 '<<< QUANTE SONO le pagine da prelevare
'
On Error Resume Next
ActiveSheet.QueryTables("pippo").Delete 'Cancella la query
On Error GoTo 0
NewConn = "URL;http://www.xxxxxxx.yy.zz/..../category.aspx?&Page=" & N & "&Sort=1&catid=14267"
NewDest = Range("B" & Rows.Count).End(xlUp).Offset(1, -1).Address
'Range(NewDest).Select
'
'Da qui e' QUASI come la tua macro originale
With ActiveSheet.QueryTables.Add(Connection:=NewConn, Destination:=Range(NewDest)) '<< Esistente ma Modificata
.Name = "pippo" '<< esistente ma Modificata
.FieldNames = True '<< Esistente
'altre istruzioni
'altre istruzioni
.Refresh BackgroundQuery:=False '<< Esistente
End With '<< Esistente
Next N '<<< Aggiunta
End Sub
Sub DatiQuery()
For Each MyIsin In Sheets("Indice").Range("A2:A86") '<< Nome Foglio e intervallo codici ISIN
If MyIsin.Value = "" Then GoTo Skippa
On Error Resume Next: CCC = ""
CCC = Sheets(MyIsin.Offset(0, 1).Value).Name
If CCC = "" Then
Sheets.Add after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = MyIsin.Offset(0, 1).Value
End If
On Error GoTo 0
Sheets(MyIsin.Offset(0, 1).Value).Select
Application.ScreenUpdating = False
Application.Calculation = xlManual
Cells.Select
Selection.Clear
On Error Resume Next
Selection.QueryTable.Delete
On Error GoTo 0
Range("A1").Select
UR = 1
[Z1] = Timer
For Rip = 0 To 90
For Each RName In ThisWorkbook.Names
RName.Delete
Next RName
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://data.nowgoal.com/1x2/bet007history.htm?id=&company=&matchdate=" & MyIsin _
, Destination:=Range("A" & UR))
.Name = "bet007history.htm?id=&company=&matchdate="
.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 = "4"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
UR = Worksheets("Foglio2").Range("A" & Rows.Count).End(xlUp).Row + 1
If Range("A" & UR - 1).Text = "Ora" Then
If UR > 1 And Range("A" & UR - 1).Text = "Ora" Then Rows(UR - 1 & ":" & UR - 1).Delete
GoTo Salta
End If
If UR > 1 And Range("A" & UR).Text = "Ora" Then Rows(UR & ":" & UR).Delete
Range("A" & UR).Select
Next Rip
Salta:
Range("A1").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
[Z2] = Timer
Skippa:
Next MyIsin
End Sub
On Error Resume Next: CCC = ""
CCC = Sheets(MyIsin.Offset(0, 1).Value).Name
On Error GoTo 0 '<<< AGGIUNGERE QUESTA, QUI
If CCC = "" Then
Sub DatiQuery()
For Each MyIsin In Sheets("CSTRIKES").Range("A2:A3") '<< Nome Foglio e intervallo codici ISIN
If MyIsin.Value = "" Then GoTo Skippa
On Error Resume Next: CCC = ""
CCC = Sheets(MyIsin.Offset(0, 1).Value).Name
If CCC = "" Then
Sheets.Add after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = MyIsin.Offset(0, 1).Value
End If
On Error GoTo 0
Sheets(MyIsin.Offset(0, 1).Value).Select
Application.ScreenUpdating = False
Application.Calculation = xlManual
Cells.Select
Selection.Clear
On Error Resume Next
Selection.QueryTable.Delete
On Error GoTo 0
Range("A1").Select
UR = 1
[Z1] = Timer
For Rip = 0 To 90
For Each RName In ThisWorkbook.Names
RName.Delete
Next RName
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.borsaitaliana.it/borsa/derivati/ftse-mib-options/scheda/" & MyIsin & ".html?lang=it" _
, Destination:=Range("A" & UR))
.Name = "Call"
.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 = "4"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
UR = Worksheets("Foglio1").Range("A" & Rows.Count).End(xlUp).Row + 1
If Range("A" & UR - 1).Text = "Ora" Then
If UR > 1 And Range("A" & UR - 1).Text = "Ora" Then Rows(UR - 1 & ":" & UR - 1).Delete
GoTo Salta
End If
If UR > 1 And Range("A" & UR).Text = "Ora" Then Rows(UR & ":" & UR).Delete
Range("A" & UR).Select
Salta:
Range("A1").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
[Z2] = Timer
Skippa:
Next MyIsin
End Sub
.WebTables = "1,2"
Torna a Applicazioni Office Windows
confrontare e evidenziare 2 fogli excel Autore: niccia |
Forum: Applicazioni Office Windows Risposte: 5 |
[EXCEL] controllo corrispondenza tra valori con un vincolo Autore: sbs |
Forum: Applicazioni Office Windows Risposte: 9 |
Macro per aprire file salvato su sharepoint Onedrive Autore: marcopont |
Forum: Applicazioni Office Windows Risposte: 2 |
Visitano il forum: Nessuno e 16 ospiti