Format code returning error

G

Guest

Oh Wise Ones,

I have a sheet that inserts a row and formats some cells including this line
that works:

Worksheets("Open Red Tags").Range("Q4").Formula = "=IF(J4=$K$1,H4,"""")"

but when I tried to format R4 like below I get an error as soon as I enter it:
Unexpected end of statement

Worksheets("Open Red Tags").Range("R4").Formula = "=IF(F4="A",H4,"""")"

Then I tried this that didn't work:

Worksheets("Open Red Tags").Range("R4").Formula = "=IF(F4=A,H4,"""")"

What am I doing wrong? They seem so similar.

Mike
 
D

Dave Peterson

You doubled up those double quotes in the last portion of the formula:
Worksheets("Open Red Tags").Range("R4").Formula = "=IF(F4="A",H4,"""")"

But don't forget to do the same with the double quotes around A.
Worksheets("Open Red Tags").Range("R4").Formula = "=IF(F4=""A"",H4,"""")"
 
G

Guest

Thanks Dave.


Dave Peterson said:
You doubled up those double quotes in the last portion of the formula:
Worksheets("Open Red Tags").Range("R4").Formula = "=IF(F4="A",H4,"""")"

But don't forget to do the same with the double quotes around A.
Worksheets("Open Red Tags").Range("R4").Formula = "=IF(F4=""A"",H4,"""")"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top