VBA IF Formula with the text having quotation marks

B-Man

Board Regular
Joined
Dec 29, 2012
Messages
183
Office Version
  1. 2019
Platform
  1. Windows
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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,214,792
Messages
6,121,612
Members
449,038
Latest member
apwr

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