Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 49956

[SOLVED] Select Case "And" ""

$
0
0
I can't convert an If statement to Select Case that uses "<>" and "And" as a condition. It works fine as an If statement, it's just bugging me that I can't make the Select Case version work. I've tried the Case syntax a few different ways. The one below gets type mismatch error. Thoughts?

Code:

For Each Sht In Application.Worksheets
    Sht.Activate
    ShtNm = ActiveSheet.Name
    If ShtNm <> "Pick Unit" And ShtNm <> "VALUES" And ShtNm <> "Weekly" Then
        ActiveSheet.Visible = xlVeryHidden
'        ActiveSheet.Visible = True
    End If
Next Sht

Code:

    For Each Sht In Application.Worksheets
        Sht.Activate
        ShtNm = ActiveSheet.Name
        Select Case ShtNm
        Case Is <> "Pick Unit" And "VALUES" And "Weekly"
            ' ActiveSheet.Visible = xlVeryHidden
            ActiveSheet.Visible = True
        End Select
    Next Sht


Viewing all articles
Browse latest Browse all 49956

Trending Articles