VBA Functions
Thanks everyone for your suggestions. Actually, the code I posted is a very
simple and complete version of of what I'm trying to do. You no doubt have
guessed that I am a complete new-comer to VBA programming. After a lot of
head scratching I came up with the code that Ron suggested and it works fine.
The function name is unimportant but it will eventually be a dotproduct
routine that doesn't care about the orientation of the two vectors. I'm
nearly finished with that.
My next project will be to row-reduce a matrix to canonical and echelon
form. In that case I will have to return another matrix, and I havent
figured out how to do that. Any suggestions would be welcome.
--
Thanks for your help
"Ron Rosenfeld" wrote:
On Thu, 16 Aug 2007 18:19:46 -0700, LesHurley
wrote:
Whats wrong with this? I get a #VALUE error:
Function DotProd(Vector1)
DotProd = Rows(Vector1)
End Function
What's "wrong" is that you are trying to return an object.
Without knowing what you are trying to do, it's hard to know how to advise you.
If you want a count of the rows in Vector 1, then try:
DotProd = Vector1.Rows.Count
If you want something else, you'll have to let us know.
--ron
|