Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Excel- Code that works elsewhere failing in new spreadhseet. 1

Status
Not open for further replies.

Danny_M

Programmer
Jan 19, 2017
2
0
0
GB
CaptureCode_rdlafg.png


Hi,
Please see the attached image. Whenever I run this code I get a 1004 runtime error when it reaches the highlighted row.
Not sure why, as this works in other similar spreadsheets and also if I just copy and paste the formulas into the desired cell it works also.
Any help greatly appreciated.

Regards
Danny
 
Not sure how it ever worked in VBA. You need:

Code:
Range("I17").Formula = "=IF(D17=[b][COLOR=#CC0000]""""[/color][/b],01)"



>if I just copy and paste the formulas into the desired cell it works als

Well, it would do, since

[tt]=IF(D17="",0, 1)[/tt]

is a legitimate Excel formula

 
brilliant, that works now but gets stuck at the next line.
I assume I need to double up on the quotation marks in all the following lines, is that correct?
 
Danny, welcome to Tek-Tips.

You ought to be able to answer your last question by taking the action you propose and observing the results.

Please copy/paste actual code/examples rather than pics, as members who might help you may not care to take the time to read/transcribe your stuff for testing.



Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top