un conseil : l'enregistreur de macro donne un code avec Activate/Select/Selection ... Il faut enelever tout cela, car cela entraîne souvent des prblèmes.
Ensuite, au lieu d'utiliser la méthode PasteSpecial, on peut utiliser la méthode Copy tout simplement :
Sheets("feuille source").Range("A1:D10").Copy destination:=Sheets("nvl feuille").Range("A1")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| With Sheets("Tabelle2").Range("G1:O2")
.HorizontalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
.Merge
ActiveCell.FormulaR1C1 = "=TODAY()" '=====> Quelle est la cellule active ??? à remplacer avec qqc du type Range(...)
With .Font
.Name = "Comic Sans MS"
.Strikethrough = False
.Superscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
.Color = -16776961
.Size = 18
.Bold = True
End With
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlMedium
End With
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
With Sheets("Tabelle1")
.Range("A3:J16").Copy destination:=Sheets("Tabelle2").Range("A3")
.Range("K3:U22").Copy destination:=Sheets("Tabelle2").Range("K3")
End With
End With |
Une grosse partie de ton code consiste à faire de la mise en forme. Il faudrait que tu essaie d'épurer cette partie là, car j'ai l'impression qu'il y a des commandes en trop.
Ici tu copies tout à partir de la ligne 3 dans la feuille "Tabelle2". Si tu veux copier à la suite, il faut utiliser derLig comme je te l'ai expliqué dans le message precedent. Tu vois comment adapter ?
Partager