Can anyone see why this throws up an error on completion. It does what i want, which is copying values from another column, removing the last two characters and finally adding a space before the last character in every cell in the column. (I know the code is wrapping on here, it doesn't in my program)
Private Sub CommandButton1_Click()
Range("e2:e2000"
.Select
Application.CutCopyMode = False
Selection.Copy
Range("f2:f2000"
.Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("F2:F2000"
.Select
Selection.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Dim cell As Range
For Each cell In Selection
If Not cell.HasFormula Then _
cell.Value = Left(cell.Value, Len(cell.Value) - 1) & " " & Right(cell.Value, 1)
Next
End Sub
Private Sub CommandButton1_Click()
Range("e2:e2000"
Application.CutCopyMode = False
Selection.Copy
Range("f2:f2000"
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("F2:F2000"
Selection.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Dim cell As Range
For Each cell In Selection
If Not cell.HasFormula Then _
cell.Value = Left(cell.Value, Len(cell.Value) - 1) & " " & Right(cell.Value, 1)
Next
End Sub