How to set range to text that includes quotation marks?

lizsunnysideup

New Member
Joined
Jun 29, 2019
Messages
36
Hello!

I'm currently having an issue with my code and below is the part I'm having trouble with:

Dim AA As Long

For AA = 1 To Cells(Rows.Count, "AF").End(xlUp).Row

If Range("AK" & AA).Value = "”USE SCC 02 FOR INITIAL DOSE, SCC 06 FOR" And Range("AK" & AA).Value = "NON 0 VALUE REQUIRED FORVACCINE ADMIN" And Range("A" & AA).Value = "" Then

Range("A" & AA).Value = "COVID BILLING ERROR"

End If

Next AA

End Sub

I'm trying to flag as COVID billing errors, but the text in column AK is exactly "USE SCC 02 FOR INITIAL DOSE, SCC 06 FOR

VBA won't let me use double quotation marks and I'm stuck as to how to fix this.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try changing it from And to Or.
 
Upvote 0
Just noticed you also have an extra set of quotes, try
VBA Code:
If Range("AK" & AA).Value = "USE SCC 02 FOR INITIAL DOSE, SCC 06 FOR" Or Range("AK" & AA).Value = "NON 0 VALUE REQUIRED FORVACCINE ADMIN" Or Range("A" & AA).Value = "" Then
 
Upvote 0
Does the USE SCC 02 FOR INITIAL DOSE, SCC 06 FOR have the " at the start of phrase in the cell?
 
Upvote 0
Then you need to double it up inside of quote marks that delineate a text constant. Instead of this...

"”USE SCC 02 FOR INITIAL DOSE, SCC 06 FOR"

use this...

"”"USE SCC 02 FOR INITIAL DOSE, SCC 06 FOR"
 
Upvote 0
Solution

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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