List Sheet & Hyperlink

D

Dolphinv4

Hi,

i have this macro which used to work but now it doesn't. This macro will
list all the sheets i have excluding those which ends with "-A". Now when i
click on the hyperlink, it shows a dialogue box "That name is not valid". Why
is this so?

Thanks.

Sub List_Hyperlink()

Range("A:A").ClearContents

x = 1
For a = 1 To (Sheets.Count - 14)
shtName = Sheets(a).Name
If Right(shtName, 2) <> "-A" Then
Sheets(a).Hyperlinks.Add anchor:=Cells(x, 1), Address:="",
SubAddress:="'" & shtName
x = x + 1
End If
Next a

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top