VBA IF Formula with the text having quotation marks

B-Man

Board Regular
Joined
Dec 29, 2012
Messages
180
Hi im trying to have an if formula in the vba code but its breaking due to the text having a quotation mark.
im trying to do this, I have tried double quotation marks but to no avail. also tried adding & Chr(34) but the text doesnt say that so it wont run.

VBA Code:
If Range("C8") = ""4" pipe"" Then

If Range("C8") = ""4" pipe"" Then
the red " is the issue
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try it like
VBA Code:
   If Range("C8") = "4"" pipe" Then
 
Upvote 0
Solution
NM i just tried adding heaps of quotation marks.... figure out that if i doubled the one in the code it worked...

If Range("C8") = "4"" pipe" Then

something so simple had me stuck for over half an hour
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,254
Members
448,556
Latest member
peterhess2002

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