+ Reply to Thread
Results 1 to 2 of 2

Want to extend If not function in vba

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-16-2012
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    378

    Want to extend If not function in vba

    Hi I'm working on a macro code to search and filter and there are more than 30 ways to search it. Unfortunately vba only allow me to do about 20 ways long. Below is my code

    If Not (Cells(x, "J") Like "*" & Target & "*" And Cells(x, "K") Like "*" & Range("F2") & "*" Or Cells(x, "H") Like "*" & Target & "*" And Cells(x, "K") Like "*" & Range("F2") & "*" Or Cells(x, "E") Like "*" & Target & "*" And Cells(x, "K") Like "*" & Range("F2") & "*" Or Cells(x, "F") Like "*" & Target & "*" And Cells(x, "K") Like "*" & Range("F2") & "*" Or Cells(x, "F") Like "*" & Target & "*" And Cells(x, "H") Like "*" & Range("F2") & "*" Or Cells(x, "K") Like "*" & Target & "*" And Cells(x, "H") Like "*" & Range("F2") & "*" Or Cells(x, "L") Like "*" & Target & "*" And Cells(x, "H") Like "*" & Range("F2") & "*" Or Cells(x, "E") Like "*" & Target & "*" And Cells(x, "H") Like "*" & Range("F2") & "*" Or Cells(x, "J") Like "*" & Target & "*" And Cells(x, "L") Like "*" & Range("F2") & "*" Or Cells(x, "H") Like "*" & Target & "*" And Cells(x, "L") Like "*" & Range("F2") & "*" Or Cells(x, "E") Like "*" & Target & "*" And Cells(x, "L") Like "*" & Range("F2") & "*") Then
                Rows(x).EntireRow.Hidden = False
            End With
    Do you know any other way around to get more of this enter to run?

    Thanks

  2. #2
    Registered User
    Join Date
    02-21-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Office 2010
    Posts
    96

    Re: Want to extend If not function in vba

    Why don't you put it on multiple lines instead of 1 huge piece of code that no one wants to look at?

    Split your code up into segments.

+ 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