Italicize the second line in an excel cell (after a line break.)

ncguzzo

New Member
Joined
May 17, 2024
Messages
4
Office Version
  1. Prefer Not To Say
Platform
  1. Windows
Hello. I am trying to italicize only part of my excel cell. I know there is code to assist with this but when I enter what I have found, it italicizes the entire cell. I am including an excel of what I need:

C. N. Arena (RA, N) - hit ALT + E to achieve the line break
Fairfield University
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I only want to Italicize the second line in my cell, the cell I exhibited is one cell. I also want to do an entire column like this, instead of manually italicizing each cell's second row.
 
Upvote 0
I understand that, but it changes the answer if there is a 3rd line or a 4th line in addition to that. So again, I ask will there only ever be 2 lines of text in the cells?
 
Upvote 0
Yes. For this particular sheet, there will only be two lines per cell in the same exact format.
 
Upvote 0
Adjust range as necessary
VBA Code:
Sub test()
Dim c As Range, r As Long
For Each c In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
    r = InStr(c.Text, Chr(10))
    If r Then c.Characters(r + 1).Font.Italic = True
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,763
Messages
6,132,582
Members
449,737
Latest member
naes

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