Rechercher : dans
Par :

[Excel] Lien entre feuille

Dernière réponse le 14 nov 2009 à 00:01:04 J0K0, le 13 nov 2009 à 02:45:29 
 Signaler ce message aux modérateurs

Bonsoir !

J'ai un petit soucis, j'ai créé une macro qui me sert à copier le contenu d'une cellule d'une feuille 1, la coller dans une feuille récapitulatif. J'aimerais après avoir fait ça créer un lien vers cette même feuille 1. Je n'y arrive qu'à moitier. Je bloc à : désigner la feuille utilisée.

Voici la macro :
Sub Macro7()
ActiveSheet.Select
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
Selection.Interior.ColorIndex = xlNone
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=Workbook, _
SubAddress:="'3'!A1"
End Sub

Merci !

Configuration: Windows XP Internet Explorer 6.0

Meilleures réponses pour « [Excel] Lien entre feuille » dans :
Insérer une image de fond sous la grille Excel VoirVous souhaitez insérer un logo sous JPEG ou autre, sous votre grille Excel : FORMAT / FEUILLE / ARRIERE PLAN s'ouvre un panneau vous présentant vos images pour sélection.... choisissez, validez. Pour le supprimer : même procédure FORMAT /...
Télécharger MOREFUNC (Macro complémentaire EXCEL) VoirMorefunc est une macro complémentaire proposant 67 nouvelles fonctions de feuille de calcul pour Excel. Ces fonctions sont compatibles avec Excel 95 à 2007. Elles ne sont pas portables sur d'autres plate-formes que Windows, ni sur d'autres...
Tableur - Les feuilles de calcul VoirLa notion de feuille de calcul Un tableur présente les données et les formules sous forme d'un tableau (lignes et colonnes) appelé feuille de calcul. Une feuille de calcul est constitué de lignes (numérotées à l'aide de chiffres) et de colonnes...

1

J0K0, le 13 nov 2009 à 22:19:58

RE, je ne comprends pas,ça ne marchequ'à moitier...je m'entends :
Sub Macro7()
ActiveSheet.Select
Range("A6:AL6").Copy
Page = ActiveSheet.Name 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
Selection.Interior.ColorIndex = xlNone
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=Workbook & Page
End Sub

La copie se fait bien, le lien se fait, mais lorsque je teste le lien j'ai une erreur :
Impossible d'ouvrir le fichier spécifique.

J'ai tendance à dire normal, faudrait que j'arrive à récupérer le nom de la feuille dans ce lien et qu'il soit unique ....

Une aide please ??

Répondre à J0K0

2

J0K0, le 14 nov 2009 à 00:00:59

Sub Macro8()
Dim rngSource As Range

ActiveSheet.Select
Range("A6:AL6").Copy
Set rngSource = Selection

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
Selection.Interior.ColorIndex = xlNone

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=rngSource.Worksheet.Name & "!" & rngSource.Address, TextToDisplay:=rngSource.Worksheet.Name

Set rngSource = Nothing
End Sub

Affaire résolue.

Répondre à J0K0

3

 J0K0, le 14 nov 2009 à 00:01:04

Sub Macro8()
Dim rngSource As Range

ActiveSheet.Select
Range("A6:AL6").Copy
Set rngSource = Selection

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
Selection.Interior.ColorIndex = xlNone

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=rngSource.Worksheet.Name & "!" & rngSource.Address, TextToDisplay:=rngSource.Worksheet.Name

Set rngSource = Nothing
End Sub

Affaire résolue.

Répondre à J0K0
Collection CommentÇaMarche.net