Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Format code returning error

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Format code returning error

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,"""")"



Mike K wrote:

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


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Format code returning error

Thanks Dave.


"Dave Peterson" wrote:

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,"""")"



Mike K wrote:

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


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code to erase an array element returning Error 2042 ??? Patachoup Excel Programming 4 June 5th 07 11:31 AM
Code required for VLookup returning #NA Marie Bayes Excel Discussion (Misc queries) 7 January 10th 07 04:01 PM
error in code to format only a few sheets in workbook JOUIOUI Excel Programming 1 July 7th 06 06:25 PM
"File Format Not Valid" When Starting Excel. Error Code 0D3F6000 EMT_Hawk Excel Discussion (Misc queries) 4 March 31st 06 09:22 PM
UDF Returning an Error Value: How to? Ron Rosenfeld Excel Programming 2 September 17th 05 07:22 PM


All times are GMT +1. The time now is 02:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"