Usine à gaz
XLDnaute Barbatruc
Bonjour à tous,
Je ne m'en sors pas avec tous ces IF et End If
J'ai besoin de votre aide.
Pour la macro si dessous, j'ai le message d'erreur suivant :
"erreur de compilation Bloc If sans End If"
Pourtant, j'en ai mis partout !!! LOL
Voici la macro :
Merci de votre aide,
Amicalement,
Lionel,
Je ne m'en sors pas avec tous ces IF et End If
J'ai besoin de votre aide.
Pour la macro si dessous, j'ai le message d'erreur suivant :
"erreur de compilation Bloc If sans End If"
Pourtant, j'en ai mis partout !!! LOL
Voici la macro :
HTML:
Sub OFnlCal()
'
' OFnlCal Macro
'
'
Application.ScreenUpdating = False
Application.EnableEvents = False
Feuil13.Select
ActiveSheet.Unprotect
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("B:L").Select
Selection.Copy
Feuil13.Select
Range("B1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("M1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("Y1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("AK1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("AW1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("BI1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("BU1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("CG1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("CS1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("DE1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("DQ1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("EC1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("EO1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("FA1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("FM1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("FY1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("GL1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("GW1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("HI1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("HU1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("IG1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("IS1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("JE1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("JQ1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Sheets("SM (2)").Select
If [k1] = "NL" Then
Columns("A:L").Select
Selection.Copy
Feuil13.Select
Range("KC1").Select
ActiveSheet.Paste
Sheets("SM (2)").Select
Columns("A:L").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
End If
Feuil13.Select
ActiveWindow.SmallScroll ToRight:=-400
Range("C1").Select
ActiveCell.FormulaR1C1 = _
"=IF(OR('OF1'!R2C2="""",'OF1'!R2C2=""n° OF""),0,IF('OF1'!RC3=""CAL"",'OF1'!R2C2,0))"
Range("E1").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-2]=0,"""",'OF1'!RC3)"
Range("G1").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-4]=0,"""",CONCATENATE(""Sem"","" "",'OF1'!R[2]C8))"
Range("I1").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-6]=0,"""",""Qté livrée : "")"
Range("K1").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-8]=0,0,IF(LOOKUP(R[1]C[-6],Exp)=""NL"",""NL"",LOOKUP(R[1]C[-6],Exp)))"
Range("B2").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[1]=0,"""",""Suivi des Rebuts"")"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-2]=0,"""",'OF1'!RC5)"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-4]=0,"""",""Période du"")"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-6]=0,"""",'OF1'!R[1]C10)"
Range("J2").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-7]=0,"""",""au"")"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=IF(R[-1]C[-8]=0,"""",'OF1'!R[1]C12)"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-1]<>"""",RC[-1],"""")"
Range("C3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C=0,"""",""Qte/Tps.Un"")"
Range("D3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C[-1]=0,"""",'OF1'!RC4)"
Range("G3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C[-4]=0,"""",""Mon tage"")"
Range("H3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C[-5]=0,"""",""Client"")"
Range("I3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C[-6]=0,"""",""Tampo"")"
Range("J3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C[-7]=0,"""",""total Rebuts"")"
Range("K3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C[-8]=0,"""",""Qté Util."")"
Range("L3").Select
ActiveCell.FormulaR1C1 = "=IF(R[-2]C[-9]=0,"""",""% rebuts"")"
Range("C4").Select
ActiveCell.FormulaR1C1 = "=IF(R1C3=0,0,ROUND('OF1'!R[1]C3,3))"
Range("D4").Select
ActiveCell.FormulaR1C1 = "=IF(R1C3=0,0,'OF1'!R[1]C4)"
Range("E4").Select
ActiveCell.FormulaR1C1 = "=IF(R1C3=0,0,'OF1'!R[1]C5)"
Range("F4").Select
ActiveCell.FormulaR1C1 = "=IF(R1C3=0,0,'OF1'!R[1]C6)"
Range("C4:F4").Select
Selection.Copy
Range("C5:F43").Select
ActiveSheet.Paste
Range("J4").Select
ActiveCell.FormulaR1C1 = _
"=IF(AND(RC[-6]=0,SUM(RC[-3]:RC[-1])>0),""Ha Ha ?"",IF(R1C[1]=""NL"",SUM(RC[-3]:RC[-1]),IF(SUM(RC[-3]:RC[-1])>(R1C[1]*RC[-7]),"" Trop"",SUM(RC[-3]:RC[-1]))))"
Range("K4").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-1]="" Ha Ha ?"",0,IF(RC[-1]=0,0,IF(R1C=""NL"",""NL"",IF(R1C>0,R1C*RC[-8],0))))"
Range("L4").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-2]="" Trop"",0.00001,IF(AND(RC[-2]=0,RC[-1]=""NL""),0,IF(AND(RC[-2]>0,RC[-1]=""NL""),0.00001,IF(RC[-1]>0,RC[-2]/RC[-1]*100,0))))"
Range("J4:L4").Select
Selection.Copy
Range("J5:L43").Select
ActiveSheet.Paste
Range("G4:I43").Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("G4").Select
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.EnableEvents = True
End Sub
Merci de votre aide,
Amicalement,
Lionel,