greenwall
New Member
- Joined
- Feb 25, 2021
- Messages
- 3
- Office Version
- 365
- 2019
- 2016
- 2013
- Platform
- Windows
Hi
I was hoping someone could help with me this as I'm a newbie. I tried searching the forums but I've not had much luck.
I'm currently working on a requirement to get rid of 3 spaces and replace it with a line break which I've managed to do. Now the problem I have is how do I display the values across multiple rows - 1 row for each line break
[/CODE]
I was hoping someone could help with me this as I'm a newbie. I tried searching the forums but I've not had much luck.
I'm currently working on a requirement to get rid of 3 spaces and replace it with a line break which I've managed to do. Now the problem I have is how do I display the values across multiple rows - 1 row for each line break
VBA Code:
[CODE=vba]
Sub InsertLineBreak()
Dim cell As Range
For Each cell In Selection
'Find non-breaking spaces Chr(160) and convert them to space characters i.e. Chr(32)
Do
cell.Value = Trim(Replace(cell.Value, Chr(160), Chr(32)))
Loop While cell.Value = Chr(160)
'Once it's converted to the normal space character then a line break Chr(13) can be inserted
cell.Value = Trim(Replace(cell.Value, " ", Chr(13)))
' Next step -- Need to display values across multiple rows on cells A31:A65
Next
End Sub