[Excel]Nom de la dernière feuille utilisée
Résolu
J0K0
Messages postés
163
Date d'inscription
Statut
Membre
Dernière intervention
-
J0K0 Messages postés 163 Date d'inscription Statut Membre Dernière intervention -
J0K0 Messages postés 163 Date d'inscription Statut Membre Dernière intervention -
Bonsoir,
Je cherche à connaître comment mettre le nom de la dernière feuille utilisée, ou comme mon cas où toutes mes feuilles sont numérotées de 0 à l'infini, prendre le plus grand nombre.
Voici une macro faite pour insérer une ligne et justement prendre le contenu de la dernière feuille active à la ligne 6 :
Sub Macro7()
Sheets("recapitulatif").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5:AL5").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("A5:AL5").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
ActiveCell.FormulaR1C1 = "='2'!R[1]C"
Range("A6:AL6").Select
End Sub
En réalité, ce qu'il me faut est à la fin :
--> ActiveCell.FormulaR1C1 = "='2'!R[1]C"
Range("A6:AL6").Select
Merci
Je cherche à connaître comment mettre le nom de la dernière feuille utilisée, ou comme mon cas où toutes mes feuilles sont numérotées de 0 à l'infini, prendre le plus grand nombre.
Voici une macro faite pour insérer une ligne et justement prendre le contenu de la dernière feuille active à la ligne 6 :
Sub Macro7()
Sheets("recapitulatif").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5:AL5").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("A5:AL5").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
ActiveCell.FormulaR1C1 = "='2'!R[1]C"
Range("A6:AL6").Select
End Sub
En réalité, ce qu'il me faut est à la fin :
--> ActiveCell.FormulaR1C1 = "='2'!R[1]C"
Range("A6:AL6").Select
Merci
A voir également:
- [Excel]Nom de la dernière feuille utilisée
- Feuille de pointage excel - Télécharger - Tableur
- Liste déroulante excel - Guide
- Supprimer dernière page word - Guide
- Verrouiller cellule excel sans verrouiller la feuille - Guide
- Word et excel gratuit - Guide
1 réponse
RE,
en fait, j'ai trouvé une autre astuce qui pour l'instant me plait assez, mais j'ai une erreur :
Sub Macro7()
ActiveSheet.Range("A6:AL6").Copy
Sheets("recapitulatif").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5:AL5").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("A5:AL5").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
'ActiveCell.FormulaR1C1 = "='2'!R[1]C"
ActiveSheet.Range("A6:AL6").Paste
'Range("A6:AL6").Select
End Sub
Cette erreur se situe à la fin :
ActiveSheet.Range("A6:AL6").Paste
Une idée ? merci !
en fait, j'ai trouvé une autre astuce qui pour l'instant me plait assez, mais j'ai une erreur :
Sub Macro7()
ActiveSheet.Range("A6:AL6").Copy
Sheets("recapitulatif").Select
Rows("5:5").Select
Selection.Insert Shift:=xlDown
Range("A5:AL5").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("A5:AL5").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
'ActiveCell.FormulaR1C1 = "='2'!R[1]C"
ActiveSheet.Range("A6:AL6").Paste
'Range("A6:AL6").Select
End Sub
Cette erreur se situe à la fin :
ActiveSheet.Range("A6:AL6").Paste
Une idée ? merci !