Fastest way to multiply two ranges

2019-09-05 22:02发布

I have two ranges in Excel of the same size, and I want to multiply them in another range using vba. For example: Range 1: Sheets("A").Range("A1:H200") Range 2: Sheets("B").Range("A1:H200") Then I need:

Sheets("C").Range("A1:H200")= Range 1 * Range 2

That is, I need each cell of Sheet C to be the multiplication of the same cell in Sheets A and B.

2条回答
该账号已被封号
2楼-- · 2019-09-05 22:39

Perhaps the fastest is to use a Sub to manipulate the cell formula in C.

Try this, you get the idea...

Option Explicit

Sub FillFormula()
    Worksheets("C").Range("A1:H200").FormulaR1C1 = "=A!RC*B!RC"
End Sub
查看更多
趁早两清
3楼-- · 2019-09-05 22:57

This will do it nearly instantly:

Sheets("C").Range("A1:H200") = [INDEX(A!A1:H200*B!A1:H200,0)]
查看更多
登录 后发表回答