Moderatori: Anthony47, Flash30005
SourceDir = "C:\pippo" '<<<< Aggiustare
Set fs = Application.FileSearch
With fs
.LookIn = SourceDir
.SearchSubFolders = False
.Filename = "*.*"
If .Execute() = 0 Then
MsgBox "No files in " & SourceDir
Exit sub
End If
End With
'Trovati file:
With fs
MsgBox "Ci sono " & .FoundFiles.Count & " file(s) found." '1
For i = 1 To .FoundFiles.Count
NomeFile = .FoundFiles(i)
MsgBox NomeFile '2
.
. qui ci metterai le istruzioni per aprire il file il cui nome completo (directory + nome) e’ nella variabile NomeFile, prendere i dati dalle celle che ti servono e metterle in coda all’ elenco preesistente (vedi Sotto)
.
.
Next i
End With
Range(“A65536").End(xlup).Offset(1,0).Select
Activecell.offset(0,1).select
For i = 1 To .FoundFiles.Count
nomefile = .FoundFiles(i)
EnableCalculation = False
..per non perdere l'indice i, non posso chiudere ogni file che si apre
ActiveWindow.Close
ActiveWindow.Close SaveChanges:=False
Perche' non provi a pubblicare l' esito del tuo lavoro
Sub Summary_schede()
'compila il file TABELLONE RIASSUNTIVO
'prelevando i dati delle SCHEDE
'inserite nella cartella SCHEDE
'legge i file presenti nella cartella seguente
SourceDir = "C:\Tabellone '<<<< Aggiornare con il path reale
Set fs = Application.FileSearch
With fs
.LookIn = SourceDir
.SearchSubFolders = False
.Filename = "*.*"
If .Execute() = 0 Then
MsgBox "No files in " & SourceDir
Exit Sub
End If
End With
'Trovati i file:
With fs
'MsgBox "Ci sono " & .FoundFiles.Count & " file(s) found." '1
'per ciascun file presente in SCHEDE opera:
EnableCalculation = False
For i = 1 To .FoundFiles.Count
nomefile = .FoundFiles(i)
' MsgBox nomefile '2
'apri il file (i)
Workbooks.Open (nomefile)
'concatena i 3 codici parziali per dare un codice clobale
Dim codice As String
Set c1 = Range("L16")
Set c2 = Range("L17")
Set c3 = Range("L18")
codice = c1 & "-" & c2 & "-" & c3
Dato1 = Range("D16").Value
Dato2 = Range("D17").Value
Dato3 = Range("D18").Text
Dato4 = Range("L19").Text
'una volta letti i dati necessari dal file (i) questo viene chiuso
ActiveWindow.Close SaveChanges:=False
Windows("TABELLONE RIASSUNTIVO.xls").Activate
Range("A65536").End(xlUp).Offset(1, 0).Value = codice
Range("B65536").End(xlUp).Offset(1, 0).Value = Dato1
Range("C65536").End(xlUp).Offset(1, 0).Value = Dato2
Range("D65536").End(xlUp).Offset(1, 0).Value = Dato3
Range("E65536").End(xlUp).Offset(1, 0).Value = Dato4
Next i
End With
EnableCalculation = True
End Sub
Come faccio ad eliminare il popup presente in apertura di files?
Application.DisplayAlerts = False
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveCell.Value = codice
ActiveCell.Offset(0, 1).Value = Dato1
ActiveCell.Offset(0, 2).Value = Dato2
ActiveCell.Offset(0, 3).Value = Dato3
ActiveCell.Offset(0, 4).Value = Dato4
Application.ScreenUpdating = False
Application.ScreenUpdating = True
Torna a Applicazioni Office Windows
Inserire dati filtrati da 2 file ad un terzo file Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 14 |
Inserire add.in nella barra di avvio veloce in excel 2003 Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 4 |
Excel: problema con date se devo unirle a testi Autore: valle1975 |
Forum: Applicazioni Office Windows Risposte: 5 |
Visitano il forum: Nessuno e 6 ospiti