Re : "erreur 1004" sur Mac
Si ça peut aider : ( en gras l'erreur)
peut il s'agir juste d un problème de compatibilité pc / mac..?
Sub Lance()
Application.Run "Nouvelles_Factures"
End Sub
Sub Nouvelles_Factures()
Dim x As Long
Dim Y As Long
Sheets("Modèle").Select
Range("I2").Select
x = Range("I2").Value
ActiveCell.FormulaR1C1 = x + 1
Sheets("Modèle").Copy After:=Sheets(2)
Sheets("Modèle (2)").Select
Range("C13").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With ActiveWorkbook.Sheets("Modèle (2)").Tab
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.399975585192419
End With
Sheets("Synthèse").Select
Range("B65536").Select
Selection.End(xlUp).Select
Y = ActiveCell.Row
Range("B" & Y + 1).Select
ActiveCell.FormulaR1C1 = "='Modèle (2)'!I5"
Range("C" & Y + 1).Select
ActiveCell.FormulaR1C1 = "='Modèle (2)'!I2"
Range("D" & Y + 1).Select
ActiveCell.FormulaR1C1 = "='Modèle (2)'!C13"
Range("E" & Y + 1).Select
ActiveCell.FormulaR1C1 = "='Modèle (2)'!F25"
Range("F" & Y + 1).Select
ActiveCell.FormulaR1C1 = "='Modèle (2)'!I33"
Range("G" & Y + 1).Select
ActiveCell.FormulaR1C1 = "='Modèle (2)'!H25"
Range("H" & Y + 1).Select
ActiveCell.FormulaR1C1 = "='Modèle (2)'!I35"
Range("C5").Select
ActiveCell.FormulaR1C1 = "=COUNT(R[3]C:R[" & Y - 4 & "]C)"
Range("E5").Select
ActiveCell.FormulaR1C1 = "=SUM(R[3]C:R[" & Y - 4 & "]C)"
Range("F5").Select
ActiveCell.FormulaR1C1 = "=SUM(R[3]C:R[" & Y - 4 & "]C)"
Range("G5").Select
ActiveCell.FormulaR1C1 = "=SUM(R[3]C:R[" & Y - 4 & "]C)"
Range("H5").Select
ActiveCell.FormulaR1C1 = "=SUM(R[3]C:R[" & Y - 4 & "]C)"
Range("H6").Select
Range("B" & Y + 1 & ":H" & Y + 1).Select
Selection.Replace What:="'I5'", Replacement:="I5", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="'I2'", Replacement:="I2", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="$M:$M", Replacement:="C13", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="'C13'", Replacement:="C13", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="'F25'", Replacement:="F25", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="'I33'", Replacement:="I33", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="'H25'", Replacement:="H25", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="'I35'", Replacement:="I35", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("B" & Y + 1 & ":J" & Y + 1).Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
Range("I" & Y + 1).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$L$1:$L$2"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Range("J" & Y + 1).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$M$1:$M$3"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Range("D" & Y + 1).Select
Selection.NumberFormat = "m/d/yyyy"
Range("E" & Y + 1 & ":H" & Y + 1).Select
Selection.NumberFormat = "#,##0.00 $"
Range("A1").Select
Sheets("Modèle (2)").Select
Sheets("Modèle (2)").Name = "Facture N°" & x + 1
Range("A1").Select
End Sub