VBA Code Compile Error

pbsir123

New Member
Joined
Feb 6, 2017
Messages
1
:confused::confused:
I am trying to insert IF formula from VBA to excel sheet but i am facing compile error : Expected End of statement " Error. please advise.
Thanks in advance.

Here is code:
Sub frm()
Sheet13.Range("T2:T15001").Formula =
"=IF(AND(E2=""N/A"",F2="",I2="",J2="",M2="",O2=""N/A""),"",IF(N2>FocalDate,CONCATENATE(I2,"" Record Date Out of Focal Date""),IF(R2=""No"",CONCATENATE(TRIM(PROPER(CompanyName)),"" record date "",TEXT($N$2:$N$15001,""mm/dd/yy""),"", payable "",TEXT(PostedDate,""mm/dd/yy""),"" but not yet posted""),IF(AND(P2>0,Q2>0),CONCATENATE(TRIM(PROPER(CompanyName)),"" of "",DOLLAR(O2),"" record date "",TEXT($N$2:$N$15001,""mm/dd/yy""),"", posted "",TEXT(PostedDate,""mm/dd/yy""),"" Less: Foreign Tax of "",DOLLAR(Q2)," And ",""ADR Fee of "",DOLLAR(P2)),"
IF(P2>0",CONCATENATE(TRIM(PROPER(CompanyName)),"" of "",DOLLAR(O2),"" record date "",TEXT(RecordDate,""mm/dd/yy""),"", posted "",TEXT(PostedDate,""mm/dd/yy""),"" Less: ADR Fee of "",DOLLAR(P2)),IF(Q2>0,CONCATENATE(TRIM(PROPER(CompanyName)),"" of "",DOLLAR(O2),""record date "",TEXT($N$2:$N$15001,""mm/dd/yy""),"", posted "",TEXT(PostedDate,""mm/dd/yy""),"" Less: Foreign Tax of "",DOLLAR(Q2)),CONCATENATE(TRIM(PROPER(CompanyName)),"" record date "",TEXT($N$2:$N$15001,""mm/dd/yy""),"", posted "",TEXT(PostedDate,""mm/dd/yy""))))))))
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Welcome to the board.

F2="" should be F2=""""

... and all similar.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
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