Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Reuse Application.WorksheetFunction

Is there a way to reuse the Application.WorksheetFunction?
For instance there are several times in the macro that I am writting
that I would like to do Application.worksheetfunction.SUM(XXXXX). It
woudl be nice if I could do Fn.Sum(XXXXX) or Fn.SUMIF(XXXXXXX)

Thanks,
Jay
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Reuse Application.WorksheetFunction

Use your own UDF:

Function zum(r As Range) As Variant
zum = Application.WorksheetFunction.Sum(r)
End Function

Sub main()
Dim r As Range
Set r = Range("A1:A10")
x = zum(r)
MsgBox (x)
End Sub

once you have defined zum(), you can re-use it over and over.
--
Gary''s Student - gsnu2007L


"jlclyde" wrote:

Is there a way to reuse the Application.WorksheetFunction?
For instance there are several times in the macro that I am writting
that I would like to do Application.worksheetfunction.SUM(XXXXX). It
woudl be nice if I could do Fn.Sum(XXXXX) or Fn.SUMIF(XXXXXXX)

Thanks,
Jay

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Reuse Application.WorksheetFunction

On Mar 12, 2:24*pm, Gary''s Student
wrote:
Use your own UDF:

Function zum(r As Range) As Variant
zum = Application.WorksheetFunction.Sum(r)
End Function

Sub main()
Dim r As Range
Set r = Range("A1:A10")
x = zum(r)
MsgBox (x)
End Sub

once you have defined zum(), you can re-use it over and over.
--
Gary''s Student - gsnu2007L



"jlclyde" wrote:
Is there a way to reuse the Application.WorksheetFunction?
For instance there are several times in the macro that I am writting
that I would like to do Application.worksheetfunction.SUM(XXXXX). *It
woudl be nice if I could do Fn.Sum(XXXXX) or Fn.SUMIF(XXXXXXX)


Thanks,
Jay- Hide quoted text -


- Show quoted text -


I need to change the function often. I am lookign for a way to reuse
the Application.WorksheetFunction section. Or turn it into Fn, so
that I only have to type Fn.Sum(XXX) or Fn.CountA(XXXX).
Thanks,
Jay
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Reuse Application.WorksheetFunction

Dim Fn As WorksheetFunction
Set Fn = Application.WorksheetFunction
MsgBox Fn.Sum(Range("A:a"))



jlclyde wrote:

On Mar 12, 2:24 pm, Gary''s Student
wrote:
Use your own UDF:

Function zum(r As Range) As Variant
zum = Application.WorksheetFunction.Sum(r)
End Function

Sub main()
Dim r As Range
Set r = Range("A1:A10")
x = zum(r)
MsgBox (x)
End Sub

once you have defined zum(), you can re-use it over and over.
--
Gary''s Student - gsnu2007L



"jlclyde" wrote:
Is there a way to reuse the Application.WorksheetFunction?
For instance there are several times in the macro that I am writting
that I would like to do Application.worksheetfunction.SUM(XXXXX). It
woudl be nice if I could do Fn.Sum(XXXXX) or Fn.SUMIF(XXXXXXX)


Thanks,
Jay- Hide quoted text -


- Show quoted text -


I need to change the function often. I am lookign for a way to reuse
the Application.WorksheetFunction section. Or turn it into Fn, so
that I only have to type Fn.Sum(XXX) or Fn.CountA(XXXX).
Thanks,
Jay


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default Reuse Application.WorksheetFunction

On Mar 12, 2:52*pm, Dave Peterson wrote:
Dim Fn As WorksheetFunction
Set Fn = Application.WorksheetFunction
MsgBox Fn.Sum(Range("A:a"))





jlclyde wrote:

On Mar 12, 2:24 pm, Gary''s Student
wrote:
Use your own UDF:


Function zum(r As Range) As Variant
zum = Application.WorksheetFunction.Sum(r)
End Function


Sub main()
Dim r As Range
Set r = Range("A1:A10")
x = zum(r)
MsgBox (x)
End Sub


once you have defined zum(), you can re-use it over and over.
--
Gary''s Student - gsnu2007L


"jlclyde" wrote:
Is there a way to reuse the Application.WorksheetFunction?
For instance there are several times in the macro that I am writting
that I would like to do Application.worksheetfunction.SUM(XXXXX). *It
woudl be nice if I could do Fn.Sum(XXXXX) or Fn.SUMIF(XXXXXXX)


Thanks,
Jay- Hide quoted text -


- Show quoted text -


I need to change the function often. *I am lookign for a way to reuse
the Application.WorksheetFunction section. *Or turn it into Fn, so
that I only have to type Fn.Sum(XXX) *or Fn.CountA(XXXX).
Thanks,
Jay


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Thanks this works exactly like I had hoped it would.

Jay


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
to reuse macros pol Excel Discussion (Misc queries) 5 October 17th 08 09:29 PM
Application.WorksheetFunction error Ayo Excel Discussion (Misc queries) 4 May 16th 08 05:04 PM
Need help with Application.WorksheetFunction Ayo Excel Discussion (Misc queries) 4 May 14th 08 11:13 PM
Accessing WorksheetFunction.XX from regular C# Forms application Jes Ramsing Excel Worksheet Functions 1 June 16th 05 12:21 PM
Application.WorksheetFunction.Match problem Carl Brehm Excel Worksheet Functions 1 January 9th 05 02:08 PM


All times are GMT +1. The time now is 05:44 PM.

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"