小编Dio*_*ogo的帖子

Excel VBA运行时错误"13"类型不匹配

我为一个文件创建了一个宏,并且它首先工作正常,但今天我一直在打开并重新启动文件和宏数百次,我总是收到以下错误:Excel VBA运行时错误'13'类型不匹配

我没有在宏中更改任何内容,也不知道为什么我会收到错误.此外,每次我运行它时都需要很长时间才能更新宏(宏必须运行大约9000行).

错误在****之间.

VBA:

Sub k()

Dim x As Integer, i As Integer, a As Integer
Dim name As String
name = InputBox("Please insert the name of the sheet")
i = 1
Sheets(name).Cells(4, 58) = Sheets(name).Cells(4, 57)
x = Sheets(name).Cells(4, 57).Value
Do While Not IsEmpty(Sheets(name).Cells(i + 4, 57))
    a = 0
    If Sheets(name).Cells(4 + i, 57) <> x Then
        If Sheets(name).Cells(4 + i, 57) <> 0 Then
            If Sheets(name).Cells(4 + i, 57) = 3 Then
                a = x
                Sheets(name).Cells(4 …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba excel-2010

9
推荐指数
1
解决办法
37万
查看次数

标签 统计

excel ×1

excel-2010 ×1

excel-vba ×1

vba ×1