Excel VBA formula call in VBA

D

DaveEngle

Hi,
Can someone tell me how to call an excel VBA formula from VBA. I
tried the following:
Activecell.value = "{=SUM(IF(COUNTIF(D4:E15,D4:E15) =0, "",
1/COUNTIF(D4:E15,D4:E15)))}" but that isn't working.
I got the code from the j-walk website. It is suppossed to return a
count of all the unique values in a range and it works fine when
entered into a cell directly.
TIA
 
M

michdenis

Hi Dave,

Try this,

Activecell = [SUM(IF(COUNTIF(D4:E15,D4:E15)=0,"",1/COUNTIF(D4:E15,D4:E15)))]


Salutations!


"DaveEngle" <[email protected]> a écrit dans le message de Hi,
Can someone tell me how to call an excel VBA formula from VBA. I
tried the following:
Activecell.value = "{=SUM(IF(COUNTIF(D4:E15,D4:E15) =0, "",
1/COUNTIF(D4:E15,D4:E15)))}" but that isn't working.
I got the code from the j-walk website. It is suppossed to return a
count of all the unique values in a range and it works fine when
entered into a cell directly.
TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top