Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel/VB中用于覆盖数据的DowithIf()未运行_Excel_Vba - Fatal编程技术网

Excel/VB中用于覆盖数据的DowithIf()未运行

Excel/VB中用于覆盖数据的DowithIf()未运行,excel,vba,Excel,Vba,我有一个Excel/VB脚本,想运行它。一旦我运行它,我得到:对象不支持此属性或方法错误438 必须纠正什么?我的代码只是对重复项进行求和:在多个重复值上加什么来求和 Sub DowithIf() rw = 2 cl = 4 erw = 1655 Do While rw < erw Cells(rw, cl).Select Cells(rw - 1, cl).Select Cells(rw, cl + 1).

我有一个Excel/VB脚本,想运行它。一旦我运行它,我得到:对象不支持此属性或方法错误438

必须纠正什么?我的代码只是对重复项进行求和:在多个重复值上加什么来求和

Sub DowithIf()
    rw = 2
    cl = 4
    erw = 1655

    Do While rw < erw
        Cells(rw, cl).Select
        Cells(rw - 1, cl).Select
        Cells(rw, cl + 1).Select
        Cells(rw, cl + 1).HorizontalAligment = xlCenter

        If Cells(rw, cl) = Cells(rw - 1, cl) Then
            Cells(rw + 1, cl) = Cells(rw, cl - 1) + Cells(rw - 1, cl - 1)
            Cells(rw, cl + 1) = Interior.Color = 13431551
        ElseIf Cells(rw, cl) = "" Then
            Exit Do
        End If

        rw = rw + 1
    Loop
End Sube
在您的代码中 Cellsrw,cl+1=内部。颜色=13431551

换成 Cellsrw,cl+1.Interior.Color=13431551

它应该可以工作

替换:

End Sube
声明如下:

End Sub

谢谢,但现在它给出了错误1004,应用程序定义或对象定义错误!谢谢,但是在vb中我的脚本中没有e,但是谢谢你的时间!嗨,锯锯。看最后一行。