【发布时间】:2016-10-24 15:02:58
【问题描述】:
我正在运行一个 VBA 脚本来自动大写和删除粘贴数据到 Excel 中的连字符。此脚本适用于单行粘贴(单单元格),但如果粘贴多行数据,则不会运行(不会更改数据)。以下是我的代码:
Private Sub worksheet_change(ByVal target As Range)
Application.EnableEvents = False
With target
On Error Resume Next
Dim rng As Range
Set rng = Range("A:U")
If Not Intersect(target, rng) Is Nothing Then
If Not .HasFormula Then
.Value = UCase(.Value)
.Value = Replace(.Value, "-", "")
End If
End If
End With
Application.EnableEvents = True
End Sub
【问题讨论】:
标签: vba excel multiple-columns paste