niklasbp
01-19-2015, 07:21 AM
I have made makro with a index sheet named "Rapport" that has column A with a list of names starting at A2 going down. Each of these names has a sheet in their name attached and now i want to make a link from each name to the sheet with their name on it.
I managed to make the names into links but i cannot get the reference correct therefore i think there is a problem with the subadress
The code i have used so far looks like this:
Sub CreateHyperlinks()
Dim finalSheet As String
Dim myRange As Excel.Range
Dim cell As Excel.Range
Set myRange = Excel.ThisWorkbook.Sheets("Rapport").Range("A1:A100")
For Each cell In myRange
Excel.ThisWorkbook.Sheets("Rapport").Hyperlinks.Add Anchor:=cell, Address:="", SubAddress:=cell.Value &"!A1"
Next cell
EndSub
can someone please help me with this =D?
/niklas
I managed to make the names into links but i cannot get the reference correct therefore i think there is a problem with the subadress
The code i have used so far looks like this:
Sub CreateHyperlinks()
Dim finalSheet As String
Dim myRange As Excel.Range
Dim cell As Excel.Range
Set myRange = Excel.ThisWorkbook.Sheets("Rapport").Range("A1:A100")
For Each cell In myRange
Excel.ThisWorkbook.Sheets("Rapport").Hyperlinks.Add Anchor:=cell, Address:="", SubAddress:=cell.Value &"!A1"
Next cell
EndSub
can someone please help me with this =D?
/niklas