Sub Prova()
'
' Prova Macro
' Creare Registro mensile
Set sh = ActiveSheet
strPath = Cells(11, 9).Value
anno = Cells(12, 9).Value
mese = Cells(13, 9).Value
ora = 2200
Set Fldr = CreateObject("scripting.filesystemobject").GetFolder(strPath)
For Each SubFldr In Fldr.SubFolders
giorno = Val(Right(SubFldr, 2))
strExtension = Dir(SubFldr.Path & "& anno & mese & giorno & ora & nome & 001.not")
Riga = giorno + 16
colonna = 2
Do While strExtension <> ""
nome = Left(Right(strExtension, 8), 1)
If nome = "8" Or nome = "9" Or nome = "A" Or nome = "B" Then Cercare i file interessati
Set wbOpen = Workbooks.Open(SubFldr & "" & strExtension)
Range("D2").Copy sh.Cells(Riga, colonna)
colonna = colonna + 1
strExtension = Dir
wbOpen.Close False
End If
strExtension = Dir
Loop
Next
End Sub
|