Cinema
10-11-2016, 06:22 AM
Hi,
I want to multiply two matrices. The first Matrix is on Sheet2 in Range(Cells(2,2):Cells(10, col)). The second Matrix is on Sheet1 in Range(Cells(2,2):Cells(col, 2)).
The result of this product (Matrix * Vector) should be written on Sheet2 in Column A.
The Variable col varies.
My code does not work :(
Sub Makro1()
Dim tool As Workbook
Dim sh2, sh1 As Worksheet
Dim col As Integer
Set sh1 = Sheet("Sheet1")
Set sh2 = Sheets("Sheet2")
Set tool = ThisWorkbook
col = tool.sh1.Cells(tool.sh1.Rows.Count, 6).End(xlUp).Row
sh2.Activate
Range("A1:A10") = WorksheetFunction.MMult(sh2.Range("Cells(2,2):Cells(10, col)"), sh1.Range("Cells(2,2):Cells(col, 2)"))
End Sub
I want to multiply two matrices. The first Matrix is on Sheet2 in Range(Cells(2,2):Cells(10, col)). The second Matrix is on Sheet1 in Range(Cells(2,2):Cells(col, 2)).
The result of this product (Matrix * Vector) should be written on Sheet2 in Column A.
The Variable col varies.
My code does not work :(
Sub Makro1()
Dim tool As Workbook
Dim sh2, sh1 As Worksheet
Dim col As Integer
Set sh1 = Sheet("Sheet1")
Set sh2 = Sheets("Sheet2")
Set tool = ThisWorkbook
col = tool.sh1.Cells(tool.sh1.Rows.Count, 6).End(xlUp).Row
sh2.Activate
Range("A1:A10") = WorksheetFunction.MMult(sh2.Range("Cells(2,2):Cells(10, col)"), sh1.Range("Cells(2,2):Cells(col, 2)"))
End Sub