Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

comportement macro différent selon excel 07 PME ou famille

2 réponses
Avatar
ptck
Bonsoir

j'ai ce bout de code dans une macro
elle marche bien sur excel 2007 office famille mais pas avec excel 2007 PME
une feuille (1) est créée alors que l'onglet fabrication existe.

si vous avez une idée

merci
ptck



'*******création de la feuille Fabrication si elle n'existe pas*********

On Error Resume Next
Worksheets("Fabrication").Select
If Err <> 0 Then Worksheets.Add(before:=Sheets(1)).Name = "Fabrication" _
: [A1] = "N° Lot": [B1] = "Nom Matières ingrédients": [C1] = "Lot
Matières ingrédients" _
: [D1] = "Quantité": [E1] = "Onglet": [F1] = "Semaine": [G1] = "mise en
baratte" _
: Range("A1:G1").Select: Selection.Font.Bold = True:
Selection.HorizontalAlignment = xlCenter

2 réponses

Avatar
michdenis
Essaie ceci :
'------------------------------------------
Sub test()
Dim Sh As Worksheet, Feuille As String
Feuille = ActiveSheet.Name
Application.ScreenUpdating = False
On Error Resume Next
Set Sh = Worksheets("Fabrication")
If Err <> 0 Then
Err.Clear
Worksheets.Add(before:=Sheets(1)).Name = "Fabrication"
With ActiveSheet
.Name = "Fabrication"
.Range("A1") = "N° Lot"
.Range("B1") = "Nom Matières ingrédients"
.Range("C1") = "Lot Matières ingrédients"
.Range("D1") = "Quantité"
.Range("E1") = "Onglet"
.Range("F1") = "Semaine"
.Range("G1") = "mise en baratte"
.Range("A1:G1").Font.Bold = True
.Range("A1:G1").EntireColumn.AutoFit
.HorizontalAlignment = xlCenter
End With
Sheets(Feuille).Activate
End If
End Sub
'------------------------------------------

"ptck" a écrit dans le message de groupe de discussion :

Bonsoir

j'ai ce bout de code dans une macro
elle marche bien sur excel 2007 office famille mais pas avec excel 2007 PME
une feuille (1) est créée alors que l'onglet fabrication existe.

si vous avez une idée

merci
ptck



'*******création de la feuille Fabrication si elle n'existe pas*********

On Error Resume Next
Worksheets("Fabrication").Select
If Err <> 0 Then Worksheets.Add(before:=Sheets(1)).Name = "Fabrication" _
: [A1] = "N° Lot": [B1] = "Nom Matières ingrédients": [C1] = "Lot
Matières ingrédients" _
: [D1] = "Quantité": [E1] = "Onglet": [F1] = "Semaine": [G1] = "mise en
baratte" _
: Range("A1:G1").Select: Selection.Font.Bold = True:
Selection.HorizontalAlignment = xlCenter
Avatar
ptck
je vais essayer
merci



"michdenis" a écrit dans le message de news:

Essaie ceci :
'------------------------------------------
Sub test()
Dim Sh As Worksheet, Feuille As String
Feuille = ActiveSheet.Name
Application.ScreenUpdating = False
On Error Resume Next
Set Sh = Worksheets("Fabrication")
If Err <> 0 Then
Err.Clear
Worksheets.Add(before:=Sheets(1)).Name = "Fabrication"
With ActiveSheet
.Name = "Fabrication"
.Range("A1") = "N° Lot"
.Range("B1") = "Nom Matières ingrédients"
.Range("C1") = "Lot Matières ingrédients"
.Range("D1") = "Quantité"
.Range("E1") = "Onglet"
.Range("F1") = "Semaine"
.Range("G1") = "mise en baratte"
.Range("A1:G1").Font.Bold = True
.Range("A1:G1").EntireColumn.AutoFit
.HorizontalAlignment = xlCenter
End With
Sheets(Feuille).Activate
End If
End Sub
'------------------------------------------

"ptck" a écrit dans le message de groupe de
discussion :

Bonsoir

j'ai ce bout de code dans une macro
elle marche bien sur excel 2007 office famille mais pas avec excel 2007
PME
une feuille (1) est créée alors que l'onglet fabrication existe.

si vous avez une idée

merci
ptck



'*******création de la feuille Fabrication si elle n'existe pas*********

On Error Resume Next
Worksheets("Fabrication").Select
If Err <> 0 Then Worksheets.Add(before:=Sheets(1)).Name = "Fabrication"
_
: [A1] = "N° Lot": [B1] = "Nom Matières ingrédients": [C1] = "Lot
Matières ingrédients" _
: [D1] = "Quantité": [E1] = "Onglet": [F1] = "Semaine": [G1] = "mise en
baratte" _
: Range("A1:G1").Select: Selection.Font.Bold = True:
Selection.HorizontalAlignment = xlCenter