Hi,
I need to display all the sheets that contain the characters (M) in the name, and place them on a sheet. These characaters can be anywhere in the name and the name can be any length.
(this macro also places hyperlinks on the names). I just about have it, but I do not have the correct syntax … below is what I have.
Again, your help is appreciated!
–cat
Sub PrintSheetNames()
N = ActiveWorkbook.Sheets.Count
For i = 1 To N
If ActiveWorkbook.Sheets(i).Visible Then
'Males first
If Find("(M)", ActiveWorkbook.Sheets(i).Name) = True Then
Sheets("Input-General").Range("A" & 129 + i) = ActiveWorkbook.Sheets(i).Name
ActiveSheet.Hyperlinks.Add Anchor:=Range("A" & 129 + i), _
Address:="", _
SubAddress:="'" & Sheets(i).Name & "'!A129", _
TextToDisplay:=Sheets(i).Name
End If
'Females next
If Find("(F)", ActiveWorkbook.Sheets(i).Name) = True Then
Sheets("Input-General").Range("D" & 129 + i) = ActiveWorkbook.Sheets(i).Name
ActiveSheet.Hyperlinks.Add Anchor:=Range("D" & 129 + i), _
Address:="", _
SubAddress:="'" & Sheets(i).Name & "'!D129", _
TextToDisplay:=Sheets(i).Name
End If
End If
Next i
Range("A" & 129 & ":A" & 129 + N).Sort Key1:=Range("A129")
Range("D" & 129 & ":D" & 129 + N).Sort Key1:=Range("D129")
End Sub