Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
to reuse macros | Excel Discussion (Misc queries) | |||
Application.WorksheetFunction error | Excel Discussion (Misc queries) | |||
Need help with Application.WorksheetFunction | Excel Discussion (Misc queries) | |||
Accessing WorksheetFunction.XX from regular C# Forms application | Excel Worksheet Functions | |||
Application.WorksheetFunction.Match problem | Excel Worksheet Functions |