Philippe LAMACHE
XLDnaute Junior
Bonjour à tous,
Je bloque avec le code ci-dessous.
Je n'arrive pas à sélectionner les feuilles nommées en fonction du critère en cellule A4.
Sub Enreg_XLS_NM_ETIQU()
Dim LaDate As String, LeParcours As String, LeRep As String
MonBUS = Feuil15.Range("B4").Value & " " & Feuil15.Range("D4").Value
MonBAT = Feuil15.Range("D5").Value
MonTYPE = "(NM ETIQUETTES)"
LaDate = Format(Date, "dd-mmm-yyyy")
LeParcours = MonBAT & " - " & MonBUS & " " & MonTYPE
LeRep = ThisWorkbook.Path & "\EXCEL pour NM ETIQUETTES\"
MonXLS = LeRep & LeParcours & "_" & LaDate & ".xlsx"
If Feuil16.[A4].Value <> "" Then KC = "EKC"
If Feuil1.[A4].Value <> "" Then KD = "EKD"
If Feuil2.[A4].Value <> "" Then KJ = "EKJ"
If Feuil36.[A4].Value <> "" Then KM = "EKM"
If Feuil38.[A4].Value <> "" Then KU = "EKU"
If Feuil3.[A4].Value <> "" Then KZ = "EKZ"
Sheets(Array(KC, KD, KJ, KM, KU, KZ)).Select Replace:=False <=== C'est ici que cela bloque !
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=MonXLS, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
Application.DisplayAlerts = True
End Sub
Si quelqu'un avait la bonté de me dépanner ...
Par avance, merci.
Philippe.
Je bloque avec le code ci-dessous.
Je n'arrive pas à sélectionner les feuilles nommées en fonction du critère en cellule A4.
Sub Enreg_XLS_NM_ETIQU()
Dim LaDate As String, LeParcours As String, LeRep As String
MonBUS = Feuil15.Range("B4").Value & " " & Feuil15.Range("D4").Value
MonBAT = Feuil15.Range("D5").Value
MonTYPE = "(NM ETIQUETTES)"
LaDate = Format(Date, "dd-mmm-yyyy")
LeParcours = MonBAT & " - " & MonBUS & " " & MonTYPE
LeRep = ThisWorkbook.Path & "\EXCEL pour NM ETIQUETTES\"
MonXLS = LeRep & LeParcours & "_" & LaDate & ".xlsx"
If Feuil16.[A4].Value <> "" Then KC = "EKC"
If Feuil1.[A4].Value <> "" Then KD = "EKD"
If Feuil2.[A4].Value <> "" Then KJ = "EKJ"
If Feuil36.[A4].Value <> "" Then KM = "EKM"
If Feuil38.[A4].Value <> "" Then KU = "EKU"
If Feuil3.[A4].Value <> "" Then KZ = "EKZ"
Sheets(Array(KC, KD, KJ, KM, KU, KZ)).Select Replace:=False <=== C'est ici que cela bloque !
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=MonXLS, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWindow.Close
Application.DisplayAlerts = True
End Sub
Si quelqu'un avait la bonté de me dépanner ...
Par avance, merci.
Philippe.