B
Bob
The following block of code strips away any formatting from copied text
before it is pasted.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim Temp As Variant
Temp = Target.Formula
On Error GoTo endit
With Application
.EnableEvents = False
.Undo
Target.Formula = Temp
.EnableEvents = True
End With
endit:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
I would like to ensure that any extra spaces in the copied text is also
removed before the text is pasted.
Can someone show me how to incorporate the Trim function in the code above.
Thanks,
Bob
before it is pasted.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim Temp As Variant
Temp = Target.Formula
On Error GoTo endit
With Application
.EnableEvents = False
.Undo
Target.Formula = Temp
.EnableEvents = True
End With
endit:
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
I would like to ensure that any extra spaces in the copied text is also
removed before the text is pasted.
Can someone show me how to incorporate the Trim function in the code above.
Thanks,
Bob