Skip to content

Instantly share code, notes, and snippets.

@int128
Created April 24, 2014 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save int128/11244516 to your computer and use it in GitHub Desktop.
Save int128/11244516 to your computer and use it in GitHub Desktop.
Macro to trim or append trailing LF
Sub TrimTrailingLFInSelection()
Dim c As Range
For Each c In Selection
If Right(c.Text, 1) = vbLf Then
c.Value = Left(c.Text, Len(c.Text) - 1)
End If
Next
End Sub
Sub AppendLFInSelection()
Dim c As Range
For Each c In Selection
If Right(c.Text, 1) <> vbLf Then
c.Value = c.Text & vbLf
End If
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment