Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1184to1188
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Kann jemand schnell mit HyperLink helfen?

Kann jemand schnell mit HyperLink helfen?
Holger
Hallo,
mir ist gerade eine super Idee gekommen.
Ich kopiere Zelle von einem Sheet in einen anderen und will beim Kopiervorgang einen HyperLink auf den ursprünglichen Datensatz setzen.
Leider klappt das mit der Syntax nicht so genau.
Sub WriteRecords(ByVal rngContract As Range, blnRecords As Boolean)
wsContracts.Range(wsContracts.Cells(rngContract.Row, 2), wsContracts.Cells(rngContract. _
Row, 2)).Copy _
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells(intRowShipments,  _
2)).Hyperlinks.Add _
Anchor:=wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)), _
Address:="", _
SubAddress:=wsContracts.Range(wsContracts.Cells(rngContract.Row, 2), wsContracts.Cells( _
rngContract.Row, 2)), _
TextToDisplay:="Back to Shipments"
End Sub
So klappt es nicht, weil die Syntax eines HyperLinks müsste so aussehen, ich denke es
liegt an der SubAddress. Wie kann ich mit den bestehenden Informationen mir einen HyperLink basteln?
Sub hyperlink
Range("H10").Hyperlinks.Add _
Anchor:=Range("H10"), _
Address:="", _
SubAddress:="Shipments!A3", _
TextToDisplay:="Back to Shipments"
End Sub

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Benutzer
Anzeige
Lösung: So gehts
27.10.2010 17:32:06
Holger
Über Try & error:
Sub WriteRecords(ByVal rngContract As Range, blnRecords As Boolean)
Dim strSubAddress As String, strTextToDisplay As String
If blnRecords = True Then
wsContracts.Range(wsContracts.Cells(rngContract.Row, 2), wsContracts.Cells(rngContract. _
Row, 2)).Copy _
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2))
wsContracts.Range(wsContracts.Cells(rngContract.Row, 3), wsContracts.Cells(rngContract. _
Row, 15)).Copy _
wsShipments.Range(wsShipments.Cells(intRowShipments, 5), wsShipments.Cells( _
intRowShipments, 17))
wsShipments.Cells(intRowShipments, 5).EntireRow.RowHeight = 12
rngContract.Offset(0, 16).Value = "Vertrag aktiv (cP planned)"
strSubAddress = "Contracts!" & wsContracts.Range(wsContracts.Cells(rngContract.Row, 2),  _
wsContracts.Cells(rngContract.Row, 2)).Address
strTextToDisplay = wsContracts.Range(wsContracts.Cells(rngContract.Row, 2), wsContracts. _
Cells(rngContract.Row, 2)).Value
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)).Hyperlinks.Add _
Anchor:=wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)), _
Address:="", _
SubAddress:=strSubAddress, _
TextToDisplay:=strTextToDisplay, _
ScreenTip:="HyperLink: Springt zum Vertragssatz für " & strTextToDisplay
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)).Font.Underline = xlUnderlineStyleNone
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)).EntireRow.Font.Color = vbBlack
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)).EntireRow.Font.Size = 8
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)).EntireRow.Font.Name = "Helvetica"
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)).Offset(0, -1).Font.Size = 2
wsShipments.Range(wsShipments.Cells(intRowShipments, 2), wsShipments.Cells( _
intRowShipments, 2)).Offset(0, -1).Font.Color = vbWhite
Else
rngContract.Offset(0, 16).Value = "Vertrag aktiv (cP not planned)"
End If
End Sub

Anzeige

299 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige