Private Sub Worksheet_Change(ByVal Target As Range)
a = Target.Row()
b = Target.Column()
Application.ScreenUpdating = False
If a <> 1 Then
If Cells(a, b) = "" And Cells(a - 1, b) <> "" Then
For x = 1 To 256
If Cells(a - 1, x).HasFormula = True Then
Cells(a - 1, x).Copy
Cells(a, x).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Next x
Cells(a, b).Select
End If
End If
Application.ScreenUpdating = True
End Sub
我复制别人个VBA程序,执行时老是显示编译错误,缺少end sub,请帮我看下是为什么
Sub aaa()
Private Sub Worksheet_Change(ByVal Target As Range)
a = Target.Row()
b = Target.Column()
Application.ScreenUpdating = False
If a <> 1 Then
If Cells(a, b) = "" And Cells(a - 1, b) <> "" Then
For x = 1 To 256
If Cells(a - 1, x).HasFormula = True Then
Cells(a - 1, x).Copy
Cells(a, x).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Next x
Cells(a, b).Select
End If
End If
Application.ScreenUpdating = True
End Sub