View Full Version : Solved: Remove line break in cell
parscon
09-16-2012, 06:52 PM
I have date like this in cell
Data 1
Data 2
Data 3
and now I need to remove the break line like this .
Data 1
Data 2
Data 3
Now how can I do this with VBA code ?
Note : I need this for column A , B, C, D, E
Thank you for your help .
Greetings,
Try in a junk copy of your wb first...
In a Standard Module:
Option Explicit
Sub example()
Dim Cell As Range
Dim n As Long
' NOTE: Change 'Sheet1' to the CodeName of the sheet to run against //
For Each Cell In Application.Intersect(Sheet1.Range("A:E"), Sheet1.UsedRange)
Cell.Value = Replace(Cell.Value, Chr(10) & Chr(10), Chr(10))
Next
End Sub
Hope that helps,
Mark
parscon
09-17-2012, 01:23 AM
Thank you very much , you save me . it is work and thank you again .
Thank you very much , you save me . it is work and thank you again .
Hi parscon,
You are most welcome and thank you for letting me know it worked. This vba thingamajig can do some nifty things:cloud9: .
Mark
It's even worse:
Sub snb()
Range("A:E").Replace String(2, Chr(10)), Chr(10)
End Sub
PS. You can do this manually as well: Ctrl-H
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.