+ Reply to Thread
Results 1 to 2 of 2

Shortening Conditional Code

  1. #1
    Forum Contributor
    Join Date
    08-20-2005
    Posts
    173

    Shortening Conditional Code

    Hi,

    The code below works fine but just wondering how to shorten the code in *
    as in reality I want to extend the number of conditions, many thanks

    For Each WKS In ThisWorkbook.Worksheets
    *If WKS.Name <> "MAIN" And WKS.Name <> "TEST" And WKS.Name *<> "TABLE" And Wks.Name <>"SIGN" Then
    WKS.Delete
    End If
    Next

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    One way is

    If InStr("MAIN,TEST,TABLE,SIGN", WKS.Name) = 0 Then

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1