VBA IF Formula with the text having quotation marks

B-Man

Board Regular
Joined
Dec 29, 2012
Messages
185
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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,223,099
Messages
6,170,111
Members
452,302
Latest member
TaMere

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