VBA Formula Error

BigNate

Board Regular
Joined
Dec 17, 2014
Messages
242
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!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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")
 
Upvote 0
Bob, thanks for your help. I added in the last part of the formula like you suggested and all is good now. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,215,511
Messages
6,125,247
Members
449,217
Latest member
Trystel

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