How to change formatting of text in a cell

techie2013

New Member
Joined
Aug 8, 2013
Messages
34
I am working with Excel 2010.

Each cell in my spread sheet column has some requirements text and a 'Note:' for that requirement. Sometimes there are two 'Notes' in one cell.

The text in each cell looks like this:

The user should be able to see all fields mentioned in 'access request functions list'.Note: See the document access request functions list' referenced above. Note: See list of fields in Appendix B.

All I need to do is find "Note:" and insert a line break before it. After applying that rule the cell text should look like this:

The user should be able to see all fields mentioned in 'access request functions list'.
Note: See the document access request functions list' referenced above.
Note: See list of fields in Appendix B.

Alternatively, I am happy to make just the "Note:" bolded. Like this:

The user should be able to see all fields mentioned in 'access request functions list'.Note: See the document access request functions list' referenced above. Note: See list of fields in Appendix B.


Any suggestions would be appreciated.

Thanks
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
try below
Code:
Sub Test()
ActiveCell.Value = Application.WorksheetFunction.Substitute(ActiveCell.Value, "Note:", Chr(10) & "Note:")
ActiveCell.WrapText = True
End Sub
 
Upvote 0
Thank you for the solution. It worked like a charm when I selected one sell and ran the Macro. How can I run it on all the cell in a column. Thanks
 
Upvote 0
how many columns you have and in which column you want to run this code ?
 
Upvote 0
select your Range where you want to run this code and run below code

Code:
Sub Test()
Dim cell As Range
For Each cell In Selection
    cell.Value = Application.WorksheetFunction.Substitute(cell.Value, "Note:", Chr(10) & "Note:")
    cell.WrapText = True
Next
End Sub
 
Upvote 0
select your Range where you want to run this code and run below code

Code:
Sub Test()
Dim cell As Range
For Each cell In Selection
    cell.Value = Application.WorksheetFunction.Substitute(cell.Value, "Note:", Chr(10) & "Note:")
    cell.WrapText = True
Next
End Sub
A little shorter (and faster)...

Code:
Sub PutNoteOnSeparateRow()
  Selection.Replace "Note:", vbLf & "Note:", xlPart
End Sub
 
Upvote 0
Yes!!! That worked for me. Thank you so much!
Can I ask you one more quick question since it is related. There is another column where I have list of items. When I run an alphabetical sort it gives me irregular results. I noticed that this is because many items have a 'leading' space (' '). How can I remove the leading spaces in all cells at one time?
 
Upvote 0
Yes!!! That worked for me. Thank you so much!
Can I ask you one more quick question since it is related. There is another column where I have list of items. When I run an alphabetical sort it gives me irregular results. I noticed that this is because many items have a 'leading' space (' '). How can I remove the leading spaces in all cells at one time?
Select the cells and run this one-liner macro against it...

Code:
Sub RemoveLeadingSpaces()
  Selection = Evaluate(Replace("IF(LEN(@),MID(@,FIND(LEFT(TRIM(@)),@),LEN(@)),"""")", "@", Selection.Address))
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top