Hi guys
looking for a hint on what my problem is with the following code.
I searched all worksheets and pulled back 3 sheets beginning with 1234567 which are in a string
I need to now unhide sheets with the names from the string
e.g 1234567 CAT to unhide sheet called 1234567 CAT
any help appreciated
thanks
MC
Function Show_Sheet(ByVal msg As String) As Boolean
Dim kitten As Worksheet
Dim cat As Variant
' cat is equal to string of names 1234567 CAT, 1234567 CATTY, 1234567 CATNIP
cat = Mid(msg, 1)
'MsgBox Mid(ws, 1)
MyOrder = "Sheet Exists! Do you wish to show records?"
Ans = MsgBox(MyOrder, vbQuestion + vbYesNo, "???")
If Ans = vbNo Then
MsgBox "Not show records" 'end
Else
For Each kitten In cat
cat.Visible = xlSheetVisible 'need to unhide all sheets where name is 1234567 CAT, 1234567 CATTY, 1234567 CATNIP
Next
End If
End Function
looking for a hint on what my problem is with the following code.
I searched all worksheets and pulled back 3 sheets beginning with 1234567 which are in a string
I need to now unhide sheets with the names from the string
e.g 1234567 CAT to unhide sheet called 1234567 CAT
any help appreciated
thanks
MC
Function Show_Sheet(ByVal msg As String) As Boolean
Dim kitten As Worksheet
Dim cat As Variant
' cat is equal to string of names 1234567 CAT, 1234567 CATTY, 1234567 CATNIP
cat = Mid(msg, 1)
'MsgBox Mid(ws, 1)
MyOrder = "Sheet Exists! Do you wish to show records?"
Ans = MsgBox(MyOrder, vbQuestion + vbYesNo, "???")
If Ans = vbNo Then
MsgBox "Not show records" 'end
Else
For Each kitten In cat
cat.Visible = xlSheetVisible 'need to unhide all sheets where name is 1234567 CAT, 1234567 CATTY, 1234567 CATNIP
Next
End If
End Function