hi guys!
this macro is little bit inefficient, need 2 seconds for every file...and for >300files is slow.
I need to update the stock price in every file (2 or 3 times every day) and then send other data calculated in theese file with new prices to another excel to compare all selected data.
Can you optimize that?
thanks
Alessio
Sub aggiorna()
'With Foglio12
Dim Myfile As String
Dim riga As Integer
Dim col As Integer
Dim num_righe As Integer
num_righe = 500
col = 7 'percorsi in colonna E
riga = 5 'parte da riga 1
For riga = 5 To 350 'num_righe
Myfile = ActiveSheet.Cells(riga, col).Value
If Myfile <> "" And Dir(Myfile) <> "" Then
Workbooks.Open Filename:=Myfile
Workbooks(Dir(Myfile)).RefreshAll
For Each xWs In Application.ActiveWorkbook.Sheets
For Each xComment In xWs.Comments
xComment.Delete
Next
Next
'Disable privacy settings warning
Application.DisplayAlerts = False
Workbooks(Dir(Myfile)).Close SaveChanges:=True
End If
Next riga
End Sub
Bookmarks