S steve r Oct 16, 2009 #1 I need to remove the empty lines from individual cells (not remove entire rows)
B Barb Reinhardt Oct 16, 2009 #2 Try this Option Explicit Sub test() Dim aWS As Excel.Worksheet Dim r As Excel.Range Dim myText As String Set aWS = ActiveSheet For Each r In aWS.UsedRange myText = Right(r.Text, 1) If myText = Chr(10) Then r.Value = Left(r.Text, Len(r.Text) - 1) End If Next r End Sub HTH, Barb Reinhardt
Try this Option Explicit Sub test() Dim aWS As Excel.Worksheet Dim r As Excel.Range Dim myText As String Set aWS = ActiveSheet For Each r In aWS.UsedRange myText = Right(r.Text, 1) If myText = Chr(10) Then r.Value = Left(r.Text, Len(r.Text) - 1) End If Next r End Sub HTH, Barb Reinhardt