Pasting a worksheet function in VBA.

J

Jako

Could someone please tell me how to paste a Worksheet Function into
cell in VBA.

For example this formula.

=SUM(IF(FREQUENCY(UNRng,UNRng)>0,1))

Also for data running form "A2" down to the last entry in the column
need to set this range as UNRng. Please also tell me how i can achiev
this in VBA.

The data is on a Workbook called "Closures" and the worksheet i
"Sheet1".

Thanks in advance
 
T

Tom Ogilvy

set rng = Range(Cells(2,1),Cells(2,1).End(xldown))
sform = " =SUM(IF(FREQUENCY(UNRng,UNRng)>0,1))"
Range("C9").FormulaArray = application.Substitute(sform,"UNRng",rng.Address)
 

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