通过vba乘以excel

时间:2014-06-19 09:29:57

标签: excel vba

我是vba编程的新手,我想创建一个程序,&#34;如何将n个列和行从一个Excel工作表复制到另一个excel工作表,并将所有值从给定的常数中加倍&#34; < / p>

1 个答案:

答案 0 :(得分:0)

作为一个模型考虑:

Sub demo()
    Dim r1 As Range, r2 As Range, C As Double
    C = 0.123
    Set r1 = Sheets("Sheet1").Range("A1:B9")
    Set r2 = Sheets("Sheet2").Range("A1:B9")

    r1.Copy r2

    For Each r In r2
        r.Value = C * r.Value
    Next r
End Sub