List Sheets excluding sheets named ***-A

D

Dolphinv4

Hi,

I want to have a Main page whereby it'll list all the sheets and hyperlink
to them. However, I want to list only those sheets which does not end with
"-A". I can't list alternate sheets because there are some sheets that does
not follow by a "**-A" sheet behind, for example,

AAA
AAA-A
BBB
BBB-A
CCC
DDD
EEE
EEE-A

How can I do that with a macro?

Thanks!

Dolphinv4
 
M

Mike H

Right click your main page sheet tab, view code and paste this in

Sub ShLink()
x = 1
For a = 1 To Sheets.Count
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

Mike
 

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