Bold only top line of excel cell

Hey,

So here is the scenario:
I have one cell that has multiple lines in it:

Steve
28
42
Seatle

I want only the top line to be bold. How would I do that? Note that I have to keep all that text in one cell

1 Like

Hi, do you already have the text in the cells and want to format the first “line” as bold, or are you inserting the 3 lines in your process?

Hey @bcorrea,

The text is already in the cells and want to format the first line as bold.

For that you will need to do a little code with the use of the Excel interop, will be something like this:

but im afraid i wont have time to help you with this today…

1 Like

@bcorrea you are great! Thanks so much

1 Like

actually i came up with this that worked for me:

Dim e As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.Application
Dim  w As Microsoft.Office.Interop.Excel.Workbook = e.Workbooks.Open("D:\UserData\Desktop\Book10.xlsx")
Dim sheet As Microsoft.Office.Interop.Excel.Worksheet = DirectCast(w.Sheets("Sheet2"),Microsoft.Office.Interop.Excel.Worksheet)
Dim range1 As  Microsoft.Office.Interop.Excel.Range = sheet.Range("A1")
Dim test As Microsoft.Office.Interop.Excel.Characters = range1.Characters(1, 6)
test.Font.Bold = True
w.Save()
w.Close()
e.Quit()

And i think you will need this package if dont have already:
image

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.