Option Explicit
Sub import()
Dim wsT As Worksheet
Dim wsF As Worksheet
Dim lRow(1) As Long
Dim iCol As Integer
Dim sFolderName As String
Dim sFname As String
Dim classeur1 As String
Dim i As Long
Dim Sh As Worksheet
Dim dl1 As Long
Dim plage1 As String
Dim plage2 As String
Dim premligne As Long
'**********************************
Dim MSGCONFIRM As Long
MSGCONFIRM = MsgBox("Voulez vous importer les actions IGP des équipes postées ?", vbQuestion + vbYesNo, "Information")
If (MSGCONFIRM = 6) Then
Rows("3:700").Select
Selection.Delete Shift:=xlUp
Selection.RowHeight = 21
Range("A3").Select
sFolderName = ThisWorkbook.Path & "\"
classeur1 = ActiveWorkbook.Name
Application.ScreenUpdating = False
Application.DisplayAlerts = False
sFname = Dir(sFolderName & "IGP_modele_Eq*.xls")
If sFname = vbNullString Then
MsgBox "Les fichiers n'ont pas été trouvés !" _
& Chr(10) & Chr(10) _
& sFolderName, vbInformation
Exit Sub
End If
premligne = 3
Set wsT = ThisWorkbook.Sheets("Suivi_general")
Do Until sFname = vbNullString
Workbooks.Open sFolderName & sFname
Set wsF = Sheets("Suivi_Actions")
For Each Sh In Workbooks(sFname).Worksheets
If Sh.Name = "Suivi_Actions" Then
dl1 = Workbooks(sFname).Sheets(Sh.Name).Range("A65536").End(xlUp).Row 'ligne disponible
plage1 = "A" & premligne & ":H" & premligne
Workbooks(sFname).Sheets(Sh.Name).Range(plage1).Copy _
Destination:=Workbooks(classeur1).Sheets("Suivi_general").Range(plage1)
For i = premligne To premligne
Next i
premligne = premligne + dl1 + 1
End If
Next Sh
Workbooks(sFname).Close False
sFname = Dir
Loop
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End If
End Sub