Hi,
Which Reference must I select to be possible to use the
worksheetfunction PRICE in Visual Basic. Thanks vincent |
Request for Question Clarification by
maniac-ga
on
11 Jan 2005 17:18 PST
Hello Vincent,
From what I can determine, you cannot directly use the Microsoft Excel
function "price" from Visual Basic. You can confirm this in the Visual
Basic editor in the following ways:
- bring up the Microsoft Excel Visual Basic help & view the entry
titled "List of Worksheet Functions available to Visual Basic". There
are several functions starting with the letter P, but PRICE is not one
of them.
- bring up the Object Browsers. Enter WorksheetFunction in the Search
Text field (near top, center) and enter. Select WorksheetFunction in
the window below and a list of methods are listed in the lower window.
Price again is not listed.
[of course - if your version of Excel shows otherwise, let me know and
I can explain how to call that function]
I can describe as an alternative method to enter the function into a
cell and extract the value [if that would help]. Please indicate if
you would accept an answer with that approach.
--Maniac
|
Clarification of Question by
thebelgian-ga
on
12 Jan 2005 01:05 PST
Hello Maniac,
No this would help, there are too many cells and it would take a too
long processing time. Thanks anyway
|
Request for Question Clarification by
maniac-ga
on
12 Jan 2005 16:15 PST
Hello Vincent,
Hmm. I did a quick test and did 100 price() calls in the spreadsheet
and copied values to separate cells in about 5 seconds. The macro
is...
Sub priceit()
For I = 1 To 100
Cells(I, 1).Formula = _
"=price(""2/15/1999"",""11/15/2007"",0.0575,0.065+(" _
& I & "*0.001),100,2,0)"
Cells(I, 2).Value = Cells(I, 1).Value
Next I
End Sub
This example can be customized to meet a number of different needs.
Just curious, but how many cells are "too many"?
--Maniac
|
Clarification of Question by
thebelgian-ga
on
18 Jan 2005 07:20 PST
Hello Maniac,
I found the solution. The references I clicked were 'funcres' and
'atpvbaen.xls' and the price function works in VBA.
Thanks
|