+ Reply to Thread
Results 1 to 3 of 3

Expected end of Statement

Hybrid View

  1. #1
    FIRSTROUNDKO via OfficeKB.com
    Guest

    Expected end of Statement

    Hi,

    I am getting the error "Expected end of Statement" for the below code
    Please can somebody help me fix this.


    Sub insert()

    Dim LastRow As Long
    With ActiveSheet
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    ..Range("D3:D" & LastRow).Formula = "=IF(OR(A3="CAR",A3="BUS",A3="TRAIN"),"X",
    "")"
    End With
    End Sub

    Thanks

    Darren

    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...tions/200604/1

  2. #2
    Ardus Petus
    Guest

    Re: Expected end of Statement

    You must double the " within double-quotes.

    Sub insert()
    Dim LastRow As Long
    With ActiveSheet
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    .Range("D3:D" & LastRow).Formula = _
    "=IF(OR(A3=""CAR"",A3=""BUS"",A3=""TRAIN""),""X"","""")"
    End With
    End Sub

    HTH
    --
    AP

    "FIRSTROUNDKO via OfficeKB.com" <u15639@uwe> a écrit dans le message de
    news:5e9ce4d01a841@uwe...
    > Hi,
    >
    > I am getting the error "Expected end of Statement" for the below code
    > Please can somebody help me fix this.
    >
    >
    > Sub insert()
    >
    > Dim LastRow As Long
    > With ActiveSheet
    > LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    > .Range("D3:D" & LastRow).Formula =

    "=IF(OR(A3="CAR",A3="BUS",A3="TRAIN"),"X",
    > "")"
    > End With
    > End Sub
    >
    > Thanks
    >
    > Darren
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...tions/200604/1




  3. #3
    Registered User
    Join Date
    04-08-2006
    Posts
    8
    "=IF(OR(A3=""CAR"",A3=""BUS"",A3=""TRAIN""),""X"","""")"

    requires double quotes

+ 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