View Single Post
 
Old 08-20-2014, 10:10 AM
ryanjohnsond@gmail.com ryanjohnsond@gmail.com is offline Windows 8 Office 2007
Novice
 
Join Date: Aug 2014
Posts: 18
ryanjohnsond@gmail.com is on a distinguished road
Default

Quote:
Originally Posted by excelledsoftware View Post
In my experience the line breaks and carriage returns take many names. I have found that if I try to replace just one type it dosnt get them all. The code below works very well to remove ALL line breaks or carriage returns.

Code:
Dim v as Variant, BadData as Variant

  
  BadData = Array (vblf, vbcrlf, vbcr, Chr(10), Chr(13))
  For Each v in BadData
    MyRange = Replace(MyRange, v, ",")
  Next v
or you can use


Code:
Dim v as Integer, BadData as Variant

  
  BadData = Array (vblf, vbcrlf, vbcr, Chr(10), Chr(13))
  For v = 0 to ubound(BadData)
    MyRange = Replace(MyRange, BadData(v), ",")
  Next v

the 2nd one uses less memory.
Didn't work. Should your code be placed inside my existing code?
Reply With Quote