End of Statement Error

ERed1

Board Regular
Joined
Jun 26, 2019
Messages
104
Hi all,

I am using this code right here
Code:
   ActiveCell.FormulaR1C1 = "=IF(RC[-1]="",IF([-35]<>"",RC[-35],"Misc"),RC[-1]"
Whenever I go to another line I get an error message that says "Expected:end of statement". I do not know why this keeps happening. It is probably something simple I am just missing. Anyone know why this isn't working?

Thanks in advance
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,857
Office Version
365
Platform
Windows
You do not have the right number of double-quotes.
With double-quotes being used as both text qualifiers, and literal double-quotes that you want in your formula, it can get quite confusing.
But there is an easy way to let Excel figure out how many it needs and where.

Simply turn on your Macro Recorder, and record yourself entering an example of the formula you want somewhere on your sheet.
Then, stop the Macro Recorder, and view the code it just recorded. That shows you the proper syntax, and you can copy and paste that into your VBA code.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
51,857
Office Version
365
Platform
Windows
You are welcome!

The Macro Recorder is a great little tool for getting snippets of code. Even us "experts" use it!
 

Forum statistics

Threads
1,086,257
Messages
5,388,710
Members
402,137
Latest member
pkulkarni

Some videos you may like

This Week's Hot Topics

Top