"erreur 1004" sur Mac

bop

XLDnaute Nouveau
Bonjour a tous,

J'ai un petit souci avec mon fichier, il s'agit en fait d'un systeme de facturier. En appuyant sur "nouvelle facture", il crée une nouvelle feuille et synthetise le tout ds un tableau.
Le fichier marche pourtant très bien sur PC, mais me fait une "erreur 1004" lorsque je l'ouvre et le modifie sur mac ( et je travaille sur mac)
Je ne maitrise pas assez VBA pour comprendre tout ce qui se passe.

Je vous joins le fichier.

N'hesitez pas si l'un de vous a une petite idée.

Merci par avance,
 

Pièces jointes

  • Modèle facturation V3 bis.xls
    62.5 KB · Affichages: 48

bop

XLDnaute Nouveau
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
 

JCGL

XLDnaute Barbatruc
Re : "erreur 1004" sur Mac

Bonjour à tous,

Peux-tu essayer ce code un peu raccourci APRES avoir associé la macro Nouvelles_Factures au bouton de la feuille "Synthèse"

VB:
Option Explicit


Sub Nouvelles_Factures()
    Dim X As Long
    Dim Y As Long


    Sheets("Modèle").Select
    X = Range("I2").Value + 1
    Range("I2") = X
    Sheets("Modèle").Copy After:=Sheets(2)
    Sheets("Modèle (2)").Select
    Range("C13").Value = Range("C13").Value
    Range("C14").Value = Range("C14").Value


    With ActiveWorkbook.Sheets("Modèle (2)").Tab
        .ThemeColor = xlThemeColorAccent2
        .TintAndShade = 0.399975585192419
    End With


    Sheets("Synthèse").Select
    Y = Sheets("Synthèse").Range("B65536").End(xlUp).Row + 1
    Range("B" & Y).Formula = "='Modèle (2)'!I5"
    Range("C" & Y).Formula = "='Modèle (2)'!I2"
    Range("D" & Y).Formula = "='Modèle (2)'!C13"
    Range("E" & Y).Formula = "='Modèle (2)'!F25"
    Range("F" & Y).Formula = "='Modèle (2)'!I33"
    Range("G" & Y).Formula = "='Modèle (2)'!H25"
    Range("H" & Y).Formula = "='Modèle (2)'!I35"
    Range("C5").Formula = "=COUNT(R[3]C:R[" & Y - 4 & "]C)"
    Range("E5").Formula = "=SUM(R[3]C:R[" & Y - 4 & "]C)"
    Range("F5").Formula = "=SUM(R[3]C:R[" & Y - 4 & "]C)"
    Range("G5").Formula = "=SUM(R[3]C:R[" & Y - 4 & "]C)"
    Range("H5").Formula = "=SUM(R[3]C:R[" & Y - 4 & "]C)"


    Range("B" & Y & ":J" & Y).Borders.LineStyle = xlContinuous


    Range("I" & Y).Select
    With Selection.Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=$L$1:$L$2"
    End With


    Range("J" & Y).Select
    With Selection.Validation
        .Delete
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=$M$1:$M$3"
    End With


    Range("D" & Y).NumberFormat = "dd/mm/yyyy"
    Range("E" & Y & ":H" & Y).NumberFormat = "#,##0.00 $"
    Sheets("Modèle (2)").Name = "Facture N¡" & X
    Range("D5").Select
End Sub

A + à tous
 

bop

XLDnaute Nouveau
Re : "erreur 1004" sur Mac

Parfait !!!! Ca a l'air de fonctionner parfaitement maintenant !!!!
Merci encore ça fait vraiment longtemps que je cherchais la solution.
Pouvez vous me dire d'ou venez l'erreur si ce n'est pas trop compliqué a expliquer..?

Je vais enfin pouvoir rattraper mon retard ds mes factures.
 

JCGL

XLDnaute Barbatruc
Re : "erreur 1004" sur Mac

Bonjour à tous,

J'ai supprimé des lignes qui ne servaient pas à grand chose.
Le code pourrait être encore raccourci mais je ne sais pas si XL Mac a les mêmes "possibilités" que XL Windows.

A + à tous
 

Discussions similaires

Réponses
9
Affichages
629

Statistiques des forums

Discussions
312 502
Messages
2 089 034
Membres
104 010
dernier inscrit
Freba