calling worksheet function from a macro

  • Thread starter Thread starter Joe Farruggio
  • Start date Start date
J

Joe Farruggio

Hi
I have written a macro in which i need to call the spreadsheet function
Fact. This gives me an error. Most of the spreadsheet functions are
simply called by using their names but not this one. Anyone have any
ideas on how to do this. By the way using the Fact function in a work
sheet does fine.
 
One generally uses
MyVar=Application.WorksheetFunction. then a drop list pops up showing
which Excel function may be used in VBA
In general, if VBA has an equivalent function, you cannot use the VBA
function (e.g MAX, SUM)
best wishes
 
Joe

You need to use the WorksheetFunction property of the application object

result=Application.WorksheetFunction.Fact(.............)

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England

(e-mail address removed)
www.nickhodge.co.uk
 
MsgBox Application.Fact(5)


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 

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

Back
Top