使用数字增量CTRL拖动时,Excel VBA代码错误

问题描述

| 我已经在我的excel中添加了VBA代码,它的作用是自动写出其余的数字(例如:当我写
2
并按Enter时,它将采用上面的数字并将其填充到
990112
[参见img]) 当键入每个数字时,此方法工作正常,但是当我使用自动递增Auto2ѭ时会引发错误 这是我的VBA代码
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oldText  As String,aboveText As String,newText As String
    If Target.Column = 3 Then
        oldText = Target.Text
        aboveText = Target.Cells(0,1).Text

        If aboveText <> \"DESIGN\" Or Target.Text <> \"\" Then

            If Len(aboveText) = 6 And Len(oldText) < 6 And Len(oldText) >= 1 Then
                Application.EnableEvents = False
                newText = Left(aboveText,6 - Len(oldText)) + oldText
                Target.Value = newText
                Application.EnableEvents = True
            End If

        End If

    End If

End Sub
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)