将列A值乘以列B值,并使用Excel VBA结果列C

我有两列A和B.范围A是A1:A6和B是B1:B6。 现在,我想乘这两列,并使用Excel VBA在列C中显示结果。 例如

ABC

2 3 6(是A1 * B1)

3 8 24

9 2 18

7 3 21

2 4 8

5 4 20

我已经试过这个代码,但没有发现它有帮助:

Range("C1:C6").Value = Range("A1:A6") * Range("B1:B6") 

请在这里指导我,因为我是VBA新手。 你的帮助真的很感激。

或者,

 for i = 1 to 6 cells(i,3) = cells(i,1) * cells(i,2) next i 

尝试这个。 我已经评论了代码,以便您不会理解它。 但是,如果你仍然这样做,然后简单地问

 '~~> This will enter the formula in the entire range in one go Range("C1:C6").Formula = "=A1*B1" '~~> This will convert the formula to values Range("C1:C6").Value = Range("C1:C6").Value