 # Multiply each cell in a range to another range

• I have two ranges say Range1 = "A1:A10" and Range2 = "B1:B15". Now i want each cell value in A1:A10 to be multiplied to the values in B1:B10 and the results to be in column "C:C". Say; C1 = A1*B1, C2=A1*B2, C3= A1*B3, Cn = A2*B1 To Bn, Cn = A3*B1 To Bn and so on... how do i do this in excel vba? Thanks in advance.

A1 = 2
A2 = 3
..... An = n
B1 = 2
B2 = 3
B3 = 4
..... Bn = n
C1 = 4 (A1 * B1)
C2 = 6 (A1 * B2)
C3 = 8 (A1 * B3)
C4 = 6 (A2 * B1)
C5 = 9 (A2 * B2)
C6 = 12 (A2 * B3)
..... Cn = An * B1 to Bn

## Files

• Re: Multiply each cell in a range to another range

I think this is what you want - essentially multiply every number in column B by the first number in column A, then multiply every number in column B by second number in column A and so on - so no matter how long column A and column B is, every number in column A has to be multiplied by every number in column B and the numbers to be placed sequentially into column C.

I hope this is what you want
Anthony

Regards
[SIZE=3]Anthony
[/SIZE]&WCF_AMPERSAND[SIZE=3]
[/SIZE]&WCF_AMPERSAND&WCF_AMPERSAND&WCF_AMPERSAND[SIZE=2]You have your way. I have my way. As for the right way, the correct way, and the only way, it does not exist.[/SIZE]

• Re: Multiply each cell in a range to another range

Thank you so much Anthony. It's what i was really trying to do. The code works perfectly.

• Re: Multiply each cell in a range to another range

This bit of code

Code
``Range("A1:A" & Range("A65000").End(xlUp).Row)``

would be better written as

Code
``Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)``

It is more generic and works for all versions of Excel and is specifically needed for Excel 2007+ which has many more rows than prior versions.

[COLOR="blue"][SIZE="4"][FONT="Verdana"]AAE[/FONT][/SIZE][/COLOR]
[COLOR="blue"]----------------------------------------------------[/COLOR]

• Re: Multiply each cell in a range to another range

Thanks for the additional info AAE. Very much appreciated.

• Re: Multiply each cell in a range to another range

Please do not quote entire posts. When quoting follow these guidelines

1. Quote ONLY if it is needed to add clarity or context for your reply. If so, then
2. Quote ONLY the specific part of the post that is relevant - - not the entire post.

This will keep thread clutter to a minimum and make the discussion easier to follow.
Thanks.

[COLOR="blue"][SIZE="4"][FONT="Verdana"]AAE[/FONT][/SIZE][/COLOR]
[COLOR="blue"]----------------------------------------------------[/COLOR]

## Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!