键入不匹配运行时错误 13,同时对多个已删除单元格撤消 Ctrl+z

马斯坦·谢克

我正在尝试在我的实时 Excel 工作表中学习 VBA。

我有 VBA 代码,第一个得到

运行时错误 13 类型不匹配

在删除多个单元格时,通过少量工作,我在删除多个单元格时没有收到错误,但是当我对多个已删除的单元格执行 UNDO 时,会发生同样的错误。

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Target.Column = 6 Then
        ThisRow = Target.Row
        If Target.Cells(1).Value = vbNullString Then Exit Sub
        If Len(Target.Offset(, -4)) = 0 Then
            Range("J" & ThisRow).Value = Time()
            Range("B" & ThisRow).Value = Date
            Range("AA" & ThisRow).Value = Environ("username")
        End If
    End If
End Sub
蒂姆·威廉姆斯

像这样的东西:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim rng As Range, c As Range

    Set rng = Application.Intersect(Target, Me.Columns(6))
    If rng Is Nothing Then Exit Sub
    For Each c In rng.Cells
        If Len(c.Value) > 0 Then
            If Len(c.Offset(0, -4).Value) = 0 Then
                With c.EntireRow
                    .Cells(1, "J").Value = Time()
                    .Cells(1, "B").Value = Date
                    .Cells(1, "AA").Value = Environ("username")
                End With
            End If
        End If
    Next c
End Sub

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

运行时错误'13':清除单元格内容时键入不匹配

选择多个单元格时评估错误:运行时错误'13':类型不匹配

得到运行时错误“ 13”:运行以下宏时键入不匹配

运行时错误13:每次我运行代码时都键入不匹配

运行时错误13在workbook.worksheets中键入不匹配

运行时错误 13:使用 DateSerial 在日期上键入不匹配

运行时错误'13:比较日期时键入不匹配-EXCEL VBA

运行时错误 13 - 尝试编辑 Lotus Notes 的富文本项时键入不匹配

运行时错误“13”:宏中的类型不匹配

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

Excel VBA运行时错误“ 13”:类型不匹配

运行时错误'13':类型不匹配,定义了PivotCahe

运行时错误13,类型不匹配MsgBox取消

运行时错误“13”类型不匹配:如果或

类型不匹配运行时错误13

运行时错误13 /类型不匹配

运行时错误 13' 类型不匹配 VBA excel

工作表运行时错误“13”:类型不匹配

删除多个单元格时出现运行时错误13

尝试检查单元格是否包含整数时出现运行时错误 13 类型不匹配

禁用Chrome的文本输入撤消/重做(CTRL + Z / CTRL + Y)

运行时错误13:尝试从另一个工作簿中调用函数时,在VBA中键入不匹配

运行时错误 13 之前成功运行的程序模块中的类型不匹配

Access 2010 VBA类型不匹配(错误13)或运行时错误424(必需的对象)

VBA Excel中的“运行时错误13:类型不匹配”错误

为什么我会收到“运行时错误 '13':类型不匹配”错误消息?

运行时错误“13”:显示来自 JSON 数组的数据时出现类型不匹配错误

从合并单元格中删除时键入不匹配 13 错误 - VBA

Excel-选择多个单元格时在VBA中键入不匹配错误13