Matrix of VBA

francesc

New Member
Joined
Apr 19, 2013
Messages
2
hi there
i am new to this forum and have a urgent question about the matrix application in VBA and want to ask you for help. the problem is about the deflection of a beam
the formula is
Q/EI = y(i-2)-4y(i-1)+6y(i)-4y(i+1)+y(i+2)
I want the output matrix is like this
1 -4 6 -4 1 0 0 0
0 1 -4 6 -4 1 0 0
0 0 1 -4 6 -4 1 0
.....
.....

is it possible?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
it's not clear for me

in the VBA program, i know how to allow the user to enter the value in each cell of a matrix
but now i want to transform a "equation into a matrix", say 3x+5y-6z
and the matrix is a 4 by 6 matrix
i expect the output is
3 5 6 0 0 0
0 3 5 6 0 0
0 0 3 5 6 0
0 0 0 3 5 6
is it possible?

thank you very much
 
Upvote 0
It would be easier to assign the values 3 5 -6 to 3 cells A1, A2, A3 then get the matrix
 
Last edited:
Upvote 0
put known terms in the first row, then try this code,
Code:
Sub a()
kterms = 3
nrow = 4
ncol = 6
drow = 3 ' destination row
Set Rng = Range(Cells(1, 1), Cells(1, kterms))
Range(Cells(drow, 1), Cells(drow + nrow - 1, ncol)) = 0
For j = 0 To nrow - 1
  Rng.Copy Cells(j + drow, j + 1)
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top