Salut à tous, Myta et Claude, et trés bon dimanche! 8)
Alors pour répondre à Claude:
Dim xlApp As New Excel.Application
Dim xlbook As New Excel.Workbook
Dim xlSheet As New Excel.Worksheet
Set xlbook = xlApp.Workbooks.Open("C:\...\BaseDonnéesPesée")
Set xlSheet = xlbook.Sheets("Feuil1")
x = xlbook.Sheets.Count
xlSheet.Select
xlSheet.Copy after:=Sheets(x)
xlbook.Sheets("Feuil1 (2)").Select
xlbook.Sheets("Feuil1 (2)").Name = NumCheptel.Value
Application.DisplayAlerts = False
xlbook.Close savechanges:=True
Application.DisplayAlerts = True
xlApp.Quit
donc si j'ai bien compris Myta, il faudrait que je rajoute
if FeuilleExiste(Numcheptel.value) is nothing then
xlSheet.Select
xlSheet.Copy after:=Sheets(x)
xlbook.Sheets("Feuil1 (2)").Select
xlbook.Sheets("Feuil1 (2)").Name = NumCheptel.Value
Application.DisplayAlerts = False
xlbook.Close savechanges:=True
Application.DisplayAlerts = True