Multiple Fonts in a Cell

mgw1138

New Member
Joined
Mar 9, 2014
Messages
33
I have a workbook that I got from running OCR on a Bill of Lading PDF document. Each Excel cell has both the Cell title and value in a single cell. Example: "Destination City" is a super script string Bold/6 point font (some rather exotic font type) with the value "Milwaukee" in Arial (12) directly under. When I put the cursor in that cell "Destination City" appears in the value line. Hit right arrow and "Milwaukee" Appears. Hit left arrow and it is back to "Destination City". Obviously there is some HTML font string commands that Excel's value line does not show or allow me to edit.

How can I create this effect with VBA?

I have multiple documents that I would like to crate using this effect.

Thanks
Michael
 
It sounds like there is just a manual line break entered in the cell, which is just made by hitting ALT-ENTER. In VBA. vbLf or CHR(10)
If you want to see the whole thing just drag your formula bar down to make it bigger.
 
Upvote 0
It sounds like there is just a manual line break entered in the cell, which is just made by hitting ALT-ENTER. In VBA. vbLf or CHR(10)
If you want to see the whole thing just drag your formula bar down to make it bigger.

Making the formula bar larger let me see both values. How do I have separate fonts before and after the VBLF?

Thanks
Michael
 
Upvote 0
Change your first font to whatever it is you are using:

Code:
Sub test()
Dim strHeader As String
strHeader = "Destination City"
With Range("A1")
    .WrapText = True
    .Value = strHeader & vbLf & "Milwaukee"
    With .Characters(1, Len(strHeader)).Font
        .Name = "Arial"
        .Size = "6"
        .Superscript = "TRUE"
        .Bold = True
    End With
    
    With .Characters(Len(strHeader) + 1).Font
        .Name = "Arial"
        .Size = "12"
        .Bold = False
    End With
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,798
Messages
6,193,063
Members
453,773
Latest member
bclever07

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