Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default multplying matrix with constant doesn't work in VBA

I have a matrix like this...

12 4 22
2 1 33
54 2 9


....and the following function...


Function myfunc(m)


myfunc = 2 * m


End Function


Passing on the matrix to exactly this funciton (letter by letter) in
Excel 2003 SP2 results in #VALUE!


Why? What is wrong here? My guess is that some data type definitions
are missing. Can somebody help?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default multplying matrix with constant doesn't work in VBA

You'll just have to loop through the rows and columns to multiply each
matrix element individually.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


wrote in message
ps.com...
I have a matrix like this...

12 4 22
2 1 33
54 2 9


...and the following function...


Function myfunc(m)


myfunc = 2 * m


End Function


Passing on the matrix to exactly this funciton (letter by letter) in
Excel 2003 SP2 results in #VALUE!


Why? What is wrong here? My guess is that some data type definitions
are missing. Can somebody help?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default multplying matrix with constant doesn't work in VBA

You'll just have to loop through the rows and columns to multiply each
matrix element individually.

I did a function which is exactly doing that.

The thing I don't understand why this is possible in a spreadsheet. For
example, naming the above mentioned matrix "aMatrix", the following
formula would product the correct result: {= 2*aMatrix}. Weird stuff,
in my opinion.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default multplying matrix with constant doesn't work in VBA

The worksheet is set up to treat worksheet ranges as a matrix in a similar
sense to our algebraic understanding of them. VBA doesn't know it's backing
up a spreadsheet program. The only difference between VBA for Excel, Word,
PowerPoint, and other applications is an object model that provides
application-specific objects and their properties and methods. VBA can
handle an array fine, although it makes you deal with the array elements
individually.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


wrote in message
ups.com...
You'll just have to loop through the rows and columns to multiply each
matrix element individually.

I did a function which is exactly doing that.

The thing I don't understand why this is possible in a spreadsheet. For
example, naming the above mentioned matrix "aMatrix", the following
formula would product the correct result: {= 2*aMatrix}. Weird stuff,
in my opinion.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I transpose nXm matrix to mXn Matrix MIHir Excel Worksheet Functions 2 August 9th 08 11:44 AM
Set a date as a constant to work back from to show only weekdays Happy Gilmore Excel Discussion (Misc queries) 3 February 17th 06 02:57 AM
Set a date as a constant to work back from to show only weekdays Happy Gilmore Excel Discussion (Misc queries) 1 January 9th 06 03:28 AM
Improrting Text file to a matrix when things are not constant. underdrain Excel Worksheet Functions 0 September 28th 05 04:00 AM


All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"