VBA Formula Error

BigNate

Board Regular
Joined
Dec 17, 2014
Messages
240
Hello Everyone,

I am getting a run time error '1004' because the syntax in the last line (ActiveCell.Formula line) of my code is not right. Can someone please tell me what I am doing wrong?

Code:
Sheets("Status").Select
Cells(2, 3).Select
Refcolumnend = Sheets("Reference").Cells(1, Columns.Count).End(xlToLeft).Column
ActiveCell.Formula = "=IF(AND(Reference!" & Cells(Refcolumnend, 3).Address(True, True) & "=PROPER(VLOOKUP(Macro!B1,Dates!$N$3:$O$14,2,0)),COUNTBLANK(Reference!" & Cells(4, Refcolumnend).Address(True, True) & ":" & Cells(8, Refcolumnend).Address(True, True) & ",""SUCCESSFUL"",""FAILED"")"

Thanks!
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

BobUmlas

Well-known Member
Joined
Mar 14, 2002
Messages
1,181
The last part of your formula comes out to be
COUNTBLANK(Reference!$G$4:$G$8,"SUCCESSFUL","FAILED")
and should be something like
COUNTBLANK(Reference!$G$4:$G$8)=0),"SUCCESSFUL","FAILED")
 

BigNate

Board Regular
Joined
Dec 17, 2014
Messages
240
Bob, thanks for your help. I added in the last part of the formula like you suggested and all is good now. Thanks again!
 

Watch MrExcel Video

Forum statistics

Threads
1,123,334
Messages
5,601,012
Members
414,421
Latest member
tonybear1994

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
Top