ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Expected end of Statement (https://www.excelbanter.com/excel-worksheet-functions/82629-expected-end-statement.html)

FIRSTROUNDKO via OfficeKB.com

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

Ardus Petus

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




MageeStringer

Expected end of Statement
 

"=IF(OR(A3=""CAR"",A3=""BUS"",A3=""TRAIN""),""X"", """")"

requires double quotes


--
MageeStringer
------------------------------------------------------------------------
MageeStringer's Profile: http://www.excelforum.com/member.php...o&userid=33298
View this thread: http://www.excelforum.com/showthread...hreadid=531841



All times are GMT +1. The time now is 11:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com