Runtime error for Range("BV")=IF(COUNTIF($AO2:$AV2,BH$1)=1,BH$1,"") & Range("BV").formula=IF(COUNTIF($AO2:$AV2,BH$1)=1,BH$1,"")

hemant86

New Member
Joined
Feb 10, 2015
Messages
32
HI,

I'm getting runtime error for Range("BV")="=IF(COUNTIF($AO2:$AV2,BH$1)=1,BH$1,"")" & Range("BV").formula="=IF(COUNTIF($AO2:$AV2,BH$1)=1,BH$1,"")"
The format works fine when I try to enter other formulas like Vlookup etc.

Need to know how to assign "=IF(COUNTIF($AO2:$AV2,BH$1)=1,BH$1,"") " to a cell through VBA

Any help is highly appreciated.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You need to double up the quotes in the formula and use a valid range.
VBA Code:
Range("BV2:BV10")="=IF(COUNTIF($AO2:$AV2,BH$1)=1,BH$1,"""")"
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,572
Members
448,972
Latest member
Shantanu2024

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