Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Replacing hard returns in long text strings.

I thought I knew how to do this, i.e. put ALT+0010 in the find box, replace
with something else. However when I try and do this in a file which contains
a lot of very long text strings (the first one is 5000 characters, the
largest nearly 10000), it doesn't work. Even if I try to replace "a" with
"b", it tells me "Formula is too long", and stops the replace function dead
in it's tracks. (this even though the field is not a formula)

I can copy an individual string to Word, and replace "manual line breaks" -
that works. However, I've got hundreds of these strings, and it has to be
done on a regular basis, so that isn't a viable option.

Any suggestions very welcome.
Thanks,
Geoff.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Replacing hard returns in long text strings.

Try this simple macro:

Sub ReturnKiller()
' gsnuxx
Dim r As Range, hardret As String
hardret = Chr(10)
For Each r In ActiveSheet.UsedRange
v = r.Value
If InStr(v, hardret) 0 Then
r.Value = Replace(v, hardret, "")
End If
Next
End Sub

--
Gary''s Student - gsnu200815


"Geoff C" wrote:

I thought I knew how to do this, i.e. put ALT+0010 in the find box, replace
with something else. However when I try and do this in a file which contains
a lot of very long text strings (the first one is 5000 characters, the
largest nearly 10000), it doesn't work. Even if I try to replace "a" with
"b", it tells me "Formula is too long", and stops the replace function dead
in it's tracks. (this even though the field is not a formula)

I can copy an individual string to Word, and replace "manual line breaks" -
that works. However, I've got hundreds of these strings, and it has to be
done on a regular basis, so that isn't a viable option.

Any suggestions very welcome.
Thanks,
Geoff.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Replacing hard returns in long text strings.

Well that was painless.

Many thanks, Geoff.

"Gary''s Student" wrote:

Try this simple macro:

Sub ReturnKiller()
' gsnuxx
Dim r As Range, hardret As String
hardret = Chr(10)
For Each r In ActiveSheet.UsedRange
v = r.Value
If InStr(v, hardret) 0 Then
r.Value = Replace(v, hardret, "")
End If
Next
End Sub

--
Gary''s Student - gsnu200815


"Geoff C" wrote:

I thought I knew how to do this, i.e. put ALT+0010 in the find box, replace
with something else. However when I try and do this in a file which contains
a lot of very long text strings (the first one is 5000 characters, the
largest nearly 10000), it doesn't work. Even if I try to replace "a" with
"b", it tells me "Formula is too long", and stops the replace function dead
in it's tracks. (this even though the field is not a formula)

I can copy an individual string to Word, and replace "manual line breaks" -
that works. However, I've got hundreds of these strings, and it has to be
done on a regular basis, so that isn't a viable option.

Any suggestions very welcome.
Thanks,
Geoff.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Replacing hard returns in long text strings.

You are quite welcome!
--
Gary''s Student - gsnu200815


"Geoff C" wrote:

Well that was painless.

Many thanks, Geoff.

"Gary''s Student" wrote:

Try this simple macro:

Sub ReturnKiller()
' gsnuxx
Dim r As Range, hardret As String
hardret = Chr(10)
For Each r In ActiveSheet.UsedRange
v = r.Value
If InStr(v, hardret) 0 Then
r.Value = Replace(v, hardret, "")
End If
Next
End Sub

--
Gary''s Student - gsnu200815


"Geoff C" wrote:

I thought I knew how to do this, i.e. put ALT+0010 in the find box, replace
with something else. However when I try and do this in a file which contains
a lot of very long text strings (the first one is 5000 characters, the
largest nearly 10000), it doesn't work. Even if I try to replace "a" with
"b", it tells me "Formula is too long", and stops the replace function dead
in it's tracks. (this even though the field is not a formula)

I can copy an individual string to Word, and replace "manual line breaks" -
that works. However, I've got hundreds of these strings, and it has to be
done on a regular basis, so that isn't a viable option.

Any suggestions very welcome.
Thanks,
Geoff.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
hard returns froggie Excel Discussion (Misc queries) 2 December 10th 07 07:50 PM
Excel wildcard ? for replacing strings in dropdown function Excel Wildcard ? Replace Excel Discussion (Misc queries) 1 January 27th 07 05:57 PM
Replacing a hard line break in Excel a_ryan1972 Excel Discussion (Misc queries) 4 October 25th 06 09:28 PM
Replacing characters in numeric text strings and SUMming rkd Excel Discussion (Misc queries) 7 April 20th 06 12:25 PM
Filter long Text strings Cimorene Excel Worksheet Functions 0 December 1st 04 04:01 AM


All times are GMT +1. The time now is 10:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"