Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleMake VBA code call a worksheet function
DescriptionThis example shows how to make VBA code call a worksheet function.
KeywordsVBA, excel, worksheet function, STDEV
CategoriesOffice
 
The following VBA function isin a standard code module. It uses Application.WorksheetFunction to call the StdDev worksheet function.
 
Public Function MyStdev(ByVal stdev_range As Range)
    ' Call the worksheet function.
    MyStdev = _
        Application.WorksheetFunction.StDev(stdev_range)
End Function
 
The following cell content calls the VBA function. Another cell on the worksheet calls StDev directly so you can compare the results.
 
=mystdev(B2:B6)
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated