Hi,
What if the function I want to use is not available in Excel.WorksheetFunction ?
Syntax: CELL(info_type,reference)
Toda.
Main Topics
Browse All TopicsHi,
In my application I'm using excel object library in order to read data form an excel sheet.
I am setting a cell value with a formula and then read the result value.
for example:
------------
Cells(x,y).Formula = '=SUM(A1:A10)'
Dim parm1 As Integer
parm1 = CInt(Cells(x,y).Value)
I would like to bypass the action of setting the formula into a cell and then read the result value, instead I would like to get the formula result directly into the memory (VB parameter)
How do I do that?
Toda
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Then you'll need to build your own functions ... what is the function you can not find ?
More info about using Microsoft Excel Worksheet Functions in Visual Basic
You can use most Microsoft Excel worksheet functions in your Visual Basic statements. To see a list of the worksheet functions you can use, see List of Worksheet Functions Available to Visual Basic.
Note Some worksheet functions aren’t useful in Visual Basic. For example, the Concatenate function isn’t needed because in Visual Basic you can use the & operator to join multiple text values.
Calling a Worksheet Function from Visual Basic
In Visual Basic, the Microsoft Excel worksheet functions are available through the WorksheetFunction object.
The following Sub procedure uses the Min worksheet function to determine the smallest value in a range of cells. First, the variable myRange is declared as a Range object, and then it’s set to range A1:C10 on Sheet1. Another variable, answer, is assigned the result of applying the Min function to myRange. Finally, the value of answer is displayed in a message box.
Sub UseFunction()
Dim myRange As Range
Set myRange = Worksheets("Sheet1").Range
answer = Application.WorksheetFunct
MsgBox answer
End SubIf you use a worksheet function that requires a range reference as an argument, you must specify a Range object. For example, you can use the Match worksheet function to search a range of cells. In a worksheet cell, you would enter a formula such as =MATCH(9,A1:A10,0). However, in a Visual Basic procedure, you would specify a Range object to get the same result.
Sub FindFirst()
myVar = Application.WorksheetFunct
.Match(9, Worksheets(1).Range("A1:A1
MsgBox myVar
End SubNote Visual Basic functions don’t use the WorksheetFunction qualifier. A function may have the same name as a Microsoft Excel function and yet work differently. For example, Application.WorksheetFunct
Inserting a Worksheet Function into a Cell
To insert a worksheet function into a cell, you specify the function as the value of the Formula property of the corresponding Range object. In the following example, the RAND worksheet function (which generates a random number) is assigned to the Formula property of range A1:B3 on Sheet1 in the active workbook.
Sub InsertFormula()
Worksheets("Sheet1").Range
End Sub
kingasa:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
Business Accounts
Answer for Membership
by: TrifonPosted on 2003-01-29 at 07:34:42ID: 7838591
Try this:
m(WS.Range ("A1:A3"))
Dim XL As Excel.Application
Dim WB As Excel.Workbook
Dim WS As Excel.Worksheet
'======================
Private Sub TestExcel()
'======================
'Creating a new instance of an Excel application
Set XL = New Excel.Application
XL.Visible = True
'Creating a workbook and a sheet
Set WB = XL.Workbooks.Add()
Set WS = WB.Worksheets.Add()
' put some values in the worksheet
WS.Cells(1, 1) = 1
WS.Cells(2, 1) = 2
WS.Cells(3, 1) = 3
Dim parm1 As Double
parm1 = Excel.WorksheetFunction.Su
Debug.Print parm1
End Sub