End of statement Error on If Statement in Macro

CVBASIMON

New Member
Joined
May 30, 2012
Messages
30
Hi all

I am trying to create an if statement within a copy paste pertaining to a rwo of data, when I add in the "SA" at the end the VBA editor comes up with a "Compile Error: Expected : End of statement: does anyone know how I could get around this?

Code:
'creating document types
FinalRow = Cells(Rows.Count, "C").End(xlUp).Row
Range("B2:B2" & FinalRow).Formula = "=if(C2="""","""","SA")"
Range("B2").Copy Destination:=Range("B2" & FinalRow)
 
You need to double up ALL the quotes..
You started to with the C2="" part, you cahnged to C2=""""

But you need to do it on the "SA" part as well, that should be ""SA""
 
Upvote 0

Forum statistics

Threads
1,226,834
Messages
6,193,214
Members
453,779
Latest member
C_Rules

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