View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Trim for Hard Returns

Select the cells you want to "trim" and run:


Sub trim_hard_returns()
Dim s As String
Dim r As Range
s = Chr(10)
For Each r In Selection
r.Value = Application.Substitute(r.Value, s, "")
Next
End Sub

--
Gary's Student


"Andrew" wrote:

I have two columns (A & B), and I want to compare the data in values in
corresponding cells. Unfortunately, the values in cell A3 (for example) may
have a hard return in it, but the value in cell B3 does not. I know that the
trim function will remove spaces, but is there a way to remove hard returns?
Does this make sense?