Bonjour,
Waouh... pas simple car il y a des erreurs dans certaines formules. Je suppose que les autres intervenants ont aussi vu cela
En prenant de base un seul code comme proposé par Pedro22, essayez ce code ci-dessous
Sub OuvrirFichiers()
Dim Fichier As String, Chemin As String, Wb As Workbook
Dim Plage As Range, Plage1 As Range, Plage2 As Range, Plage3 As Range
Dim cel As Range
With Application
.ReferenceStyle = xlR1C1 'mise au style L1C1 du au ref des formules dans le fichier
.ScreenUpdating = False
End With
Chemin = "M:\Administratif\Land\Exploitation_Generale\300-Centre Routier\12-PASQUIER Katia\9_POP\POP NEW"
Fichier = Dir(Chemin & "*.xlsx")
Do While Fichier <> ""
Set Wb = Workbooks.Open(Chemin & Fichier)
Application.Calculation = xlCalculationManual
With Wb.Sheets("POP")
Set Plage1 = .Range(.Cells(32, 5), .Cells(48, 30))
Set Plage2 = .Range(.Cells(58, 5), .Cells(64, 30))
Set Plage3 = .Range(.Cells(66, 5), .Cells(72, 30))
Set Plage = Union(Plage1, Plage2, Plage3)
For Each cel In Plage
If cel <> "" Then
cel.NumberFormat = "General"
cel.TextToColumns Destination:=cel, DataType:=xlFixedWidth, _
FieldInfo:=Array(0, 1), TrailingMinusNumbers:=True
End If
On Error Resume Next
cel.FormulaLocal = cel.FormulaLocal
Next cel
End With
Application.Calculation = xlCalculationAutomatic
Wb.Close True 'Fermer et sauvegarder
Fichier = Dir 'Passer au fichier suivant
Loop
With Application
.ReferenceStyle = xlA1
.ScreenUpdating = True
End With
End Sub
A noter que si vous avez 60 fichiers à faire d'un seul coup, vous aurez le temps d'aller boire un café avant que cela se termine.
Cordialement