Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2018, 08:20 PM
Gilvv Gilvv is offline Any macro to selectively get rid of soft returns? Windows 7 64bit Any macro to selectively get rid of soft returns? Office 2010 64bit
Advanced Beginner
Any macro to selectively get rid of soft returns?
 
Join Date: Oct 2016
Posts: 30
Gilvv is on a distinguished road
Default Any macro to selectively get rid of soft returns?

Hello,

I wonder if anyone may have a macro suggestion to selectively get rid of soft returns.



For a number of reasons, I only want to get rid of soft returns in chunks of text so that the sentences are continuous (not segmented, like in the image attached). Essentially, I want to change the soft returns to blank spaces but only in the chunks of text.

Any help would be greatly appreciated.
Attached Images
File Type: png Capture 3.PNG (24.9 KB, 23 views)
Reply With Quote
  #2  
Old 05-13-2018, 09:36 PM
macropod's Avatar
macropod macropod is offline Any macro to selectively get rid of soft returns? Windows 7 64bit Any macro to selectively get rid of soft returns? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your displayed screenshot suggests you're using Word, but you've posted in the Excel forum. Please clarify.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-13-2018, 10:40 PM
Gilvv Gilvv is offline Any macro to selectively get rid of soft returns? Windows 7 64bit Any macro to selectively get rid of soft returns? Office 2010 64bit
Advanced Beginner
Any macro to selectively get rid of soft returns?
 
Join Date: Oct 2016
Posts: 30
Gilvv is on a distinguished road
Default

Hello,

Thank you for your reply.

It is in Excel. I just posted the text through Word to show the soft returns.
Reply With Quote
  #4  
Old 05-13-2018, 11:04 PM
macropod's Avatar
macropod macropod is offline Any macro to selectively get rid of soft returns? Windows 7 64bit Any macro to selectively get rid of soft returns? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I suspect you want to do something like:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long, j As Long, StrTmp As String
With Selection
  For i = 1 To .Cells.Count
    StrTmp = .Cells(i).Value
    For j = Len(StrTmp) - 1 To 1 Step -1
      If Mid(StrTmp, j, 1) = Chr(10) Then
        If (Mid(StrTmp, j - 1, 1) <> Chr(10)) And (Mid(StrTmp, j + 1, 1) <> Chr(10)) Then
          StrTmp = Left(StrTmp, j - 1) & " " & Right(StrTmp, Len(StrTmp) - j)
        ElseIf (Mid(StrTmp, j + 1, 1) = Chr(10)) And (Mid(StrTmp, j + 2, 1) = Chr(10)) Then
          StrTmp = Left(StrTmp, j - 1) & Right(StrTmp, Len(StrTmp) - j)
        End If
      End If
    Next
    .Cells(i).Value = StrTmp
  Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-14-2018, 06:36 AM
Gilvv Gilvv is offline Any macro to selectively get rid of soft returns? Windows 7 64bit Any macro to selectively get rid of soft returns? Office 2010 64bit
Advanced Beginner
Any macro to selectively get rid of soft returns?
 
Join Date: Oct 2016
Posts: 30
Gilvv is on a distinguished road
Default

Thank you, so much!

I truly appreciate it.

I'll try it and will let you know.

Best regards.
Reply With Quote
  #6  
Old 05-14-2018, 09:40 PM
Gilvv Gilvv is offline Any macro to selectively get rid of soft returns? Windows 7 64bit Any macro to selectively get rid of soft returns? Office 2010 64bit
Advanced Beginner
Any macro to selectively get rid of soft returns?
 
Join Date: Oct 2016
Posts: 30
Gilvv is on a distinguished road
Default

Paul,
Thank you so very much!
You are a magician.
The macro works like a charm.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any macro to selectively get rid of soft returns? Macro To Delete Specific Carriage Returns NeviZero Word VBA 2 02-09-2018 02:16 PM
Any macro to selectively get rid of soft returns? Can't Get Centering right with soft return Nathan8752 Word 10 11-19-2015 07:06 AM
Any macro to selectively get rid of soft returns? how to selectively highlight text in word cnyoon2 Word 1 08-04-2015 08:16 AM
Need to Selectively Merge Records to Different Places in a Word Directory-type Document TotheMoonAlice Mail Merge 3 03-27-2015 08:11 AM
How can I tag and selectively extract text (multiple files)? PaulFitz Word VBA 12 10-31-2014 08:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft