dfolzenlogen
New Member
- Joined
- Oct 18, 2009
- Messages
- 36
I found the following formula for removing trailing commas on this site:
Sub RemoveTrailingCommas_Version1()
Dim Cell As Range
For Each Cell In Selection
Cell.Value = Replace(Replace(RTrim(Replace(Replace(Cell.Value, " ", Chr(1)), ",", " ")), " ", ","), Chr(1), " ")
Next
End Sub
I want to remove trailing semicolons so I changed the formula to read as follows:
Sub RemoveTrailingSemicolon()
Dim Cell As Range
For Each Cell In Selection
Cell.Value = Replace(Replace(RTrim(Replace(Replace(Cell.Value, " ", Chr(59)), ";", " ")), " ", ";"), Chr(59), " ")
Next
End Sub
Unfortunately, the above formula is removing all other semicolons in the cell which is separating other data. What am I missing?
Thanks.
Sub RemoveTrailingCommas_Version1()
Dim Cell As Range
For Each Cell In Selection
Cell.Value = Replace(Replace(RTrim(Replace(Replace(Cell.Value, " ", Chr(1)), ",", " ")), " ", ","), Chr(1), " ")
Next
End Sub
I want to remove trailing semicolons so I changed the formula to read as follows:
Sub RemoveTrailingSemicolon()
Dim Cell As Range
For Each Cell In Selection
Cell.Value = Replace(Replace(RTrim(Replace(Replace(Cell.Value, " ", Chr(59)), ";", " ")), " ", ";"), Chr(59), " ")
Next
End Sub
Unfortunately, the above formula is removing all other semicolons in the cell which is separating other data. What am I missing?
Thanks.