Run-time 1004 - "=" within a string

newtolivieri

New Member
Joined
Mar 19, 2010
Messages
13
Hi all,

First post here.

I'm getting '1004' on this instruction: Selection.Formula = ConcFormula

ConcFormula is a String which has: =CONCATENATE("(select ";$B$6;" from ";$B$2;" where ";$B$3;" = ";"'";$B$4;"' AND ";$C$3;" = ";"'";$C$4;"'";")")

The desired result is an SQL Select statement.

At first, I thought the error was with the double quotes with the string while composing the contents, so I used a bunch of "chr(34)" in the code, but it turns out the problem, at least now, is with the '=' character within the string, for when I remove it, it doesn't give me '1004'.

Thanks,
Newton
 
If all you ultimately need is the SQL then I don't see why you need the formulas.

You could just create the SQL strings in VBA and put them in the appropriate places.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top