我一直在寻找这样的宏。
宏抛出 1004 错误,并Columns(l + 1).Insert
以黄色突出显示
This selection is not valid
Copy and past areas cannot overlap unless they'er the same size and shape
有 107 行,可能代码正在处理整列而不仅仅是 107 行?不知道如何解决这个问题
谢谢
Sub f()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
On Error GoTo Skipit
HeaderNames = Array("RespID", "Subject", "Tag", "Strengths Comments", "Improvement Comments")
For l = 0 To UBound(HeaderNames)
Columns(Rows(1).Find(HeaderNames(l), , xlValues, xlWhole).Column).Cut
Columns(l + 1).Insert
Skipit:
Next
ActiveSheet.UsedRange.Offset(, l).ClearContents
Application.ScreenUpdating = True
Application.DisplayAlerts = True
On Error GoTo 0
End Sub