错误450:vba上的参数数量错误或属性分配无效

时间:2016-02-29 17:27:00

标签: vba excel-vba macros excel

我正在编写excel表格,当我按下一个按钮时,循环会遍历某些行,并且如果它们是空的则会编辑一些数据但我似乎无法运行宏,因为它会一直返回450错误。 下面是一个不会运行的代码的简化版本。(在粘贴时,在结束子格式化的选项显式结束处开始)

Option Explicit

Sub Copypaste()
'
' Copypaste Macro
'
' Keyboard Shortcut: Ctrl+p
'
    Dim i As Integer, j As Integer
    Dim ls As Boolean

    i = 2
    j = 24
    ls = True

    Do While ls = True

        If IsEmpty(i, j) = True Then
            Cells(i, j).Value = 10
            ls = False
        Else
            ls = True
        End If

        i = i + 1
        j = j + 1

        If i > 10 Then
            ls = False
        End If
    Loop
End Sub

我已经搜索了很多线程,我似乎无法找到任何与我相同问题的人,因为我所做的任何修复似乎都不是问题。

今天发现它的宏新功能可能是多个错误的情况

1 个答案:

答案 0 :(得分:1)

您需要更改

If IsEmpty(i, j) = True Then

If IsEmpty(Cells(i, j).Value2) = True Then