Hi, I'm fighting with a macro to create hyperlinks.
The hyperlink point into another sheet of the same workbook.
Here the code:
'capannone interno
Dim sFila(1 To 5) As String
sFila(1) = "A"
sFila(2) = "H"
sFila(3) = "O"
sFila(4) = "V"
sFila(5) = "AC"
Worksheets("Nomi").Activate
test = 6
n = 201
For rig = 562 To 1354 Step 40
For i = 1 To 5
Set cella = range(Cells(rig, 1), Cells(rig + 7, 1))
cella.Select
MsgBox cella.Address ' this messagebox give me the exact information!
MsgBox n
MsgBox ("Esterno!" & sFila(i) & test)
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", _
SubAddress:="Esterno!" & sFila(i) & test, _
TextToDisplay:=CStr(n)
With ActiveCell
.Value = n
.Font.Color = vbRed
.Font.Size = 20
.Font.Bold = True
End With
rig = rig + 8
n = n + 1
Next i
test = test + 3
Next rig
MsgBox ("OK!")
End Sub
The 3 messagebox in the code give me the correct information but I don't understand why the code don't work.
first message box: $A$562:$A$569 (that is the first merged cell I want to made hyperlink, the 201 sheet Nomi)
second message box: 201 (that is the cell value)
third message box: Esterno!A6 (the cell where the hyperlink point to)
for some reason the code skip this information and in the range $A$562:$A$569 even if the message box tell me that is working in the next range (from message box, $A570:$A$577, the merged cell 202) he write the new information so the cell 202 and the hyperlink is Esterno!H6. In the previus range (the A562:A569) I don't find something strange. 
Anyway, the merged cell 201 in Nomi point to cell 202 in Esterno, and 202 in Nomi point to 202 in Esterno and so on. The problem is only in the first merged cell.
Thanks to anyone for the help!
This is the worksheet Nomi
2.png
and this is the worksheet Esterno
1.png
Bookmarks