Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default calling worksheet function from a macro

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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default calling worksheet function from a macro

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
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Joe Farruggio" wrote in message
...
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.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,173
Default calling worksheet function from a macro

Joe

You need to use the WorksheetFunction property of the application object

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

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

HIS
www.nickhodge.co.uk

"Joe Farruggio" wrote in message
...
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.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,726
Default calling worksheet function from a macro

MsgBox Application.Fact(5)


--

HTH

Bob Phillips

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

"Joe Farruggio" wrote in message
...
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Get macro to run on any worksheet without renaming the sheet? Andrew B Excel Discussion (Misc queries) 6 July 26th 06 03:03 AM
macro or worksheet function? rc Excel Worksheet Functions 3 March 31st 06 04:26 AM
Offset function referencing worksheet Jeff Excel Discussion (Misc queries) 1 September 11th 05 07:01 PM
Worksheet Function - Find? DAA Excel Worksheet Functions 2 February 24th 05 04:15 PM


All times are GMT +1. The time now is 09:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"