Results 1 to 5 of 5

Thread: [RESOLVED] Excel Syntax Error

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    San Jose, CA

    Resolved [RESOLVED] Excel Syntax Error

    This is part of a sub that does some things with 4 digit strings. cel is a range. This code shows a syntax error; what's wrong with it?

     For Each cel In MyRange
                If Left$(Cells(lngRow, "CR"), 3) = cel.value or_
                   Left$(Cells(lngRow, "CR"), 2) & Right$(Cells(lngRow, "CR"), 1) = cel.value  or _
                   Right$(Cells(lngRow, "CR"), 3) = cel.value or _
                   left$(Cells(lngRow, "CR"), 1) & Right$(Cells(lngRow, "CR"), 2) = cel.value then
                End If

  2. #2
    Join Date
    Nov 2017

    Re: Excel Syntax Error

    Is it just the fact that there is no space between "or" and "_" in the first line?

  3. #3
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    To the moon and then left

    Re: Excel Syntax Error

    Quote Originally Posted by OptionBase1 View Post
    Is it just the fact that there is no space between "or" and "_" in the first line?
    Don't see anything else, either.

    Trying to figure out what you're trying to do with those Left/Right.
    Looks like you're trying to find a pattern
    Last edited by Zvoni; Tomorrow at 31:69 PM.

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    Code is like a joke: If you have to explain it, it's bad

  4. #4
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Paris, France

    Re: Excel Syntax Error

    You need a space between or and _ in the first line
    The best friend of any programmer is a search engine
    "Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
    “They did not know it was impossible so they did it” (Mark Twain)

  5. #5

Posting Permissions

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

Click Here to Expand Forum to Full Width