• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Displaying and Printing the Name of Size of Font in Excel

I am printing 20-30 spreadsheets, each using a different font and various font sizes for a selection committee.  Can I display and print the name and size of the font being used in the column (or cell) above.
0
Bill Golden
Asked:
Bill Golden
3 Solutions
 
Martin LissOlder than dirtCommented:
You could modify this macro to suit your situation. Currently it displays the font name and size of C2's font in C1.

Sub DisplayFont()
Range("C1") = "Font name: " & Range("C2").Font.Name & " Font Size: " & Range("C2").Font.Size
End Sub

Open in new window

0
 
Saqib Husain, SyedEngineerCommented:
You can use a UDF for this

Enter this code in a new module

Function fontnamesize(rng As Range)
fontnamesize = rng.Font.Name & " " & rng.Font.Size
End Function


In excel enter this formula

=fontnamesize(B4)

where B4 is the address of the cell whose font properties needs to be returned.
0
 
Martin LissOlder than dirtCommented:
Using my code as a basis here's another UDF

Function DisplayFont(r As Range) As String
DisplayFont = "Font name: " & r.Offset(1, 0).Font.Name & " Font Size: " & r.Offset(1, 0).Font.Size
End Function

Open in new window


Usage: =DisplayFont((C2))
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
dsackerContract ERP Admin/ConsultantCommented:
It has to be done from a VBA macro. Something like this would work:
Public Sub FontName()
    If ActiveCell.Row > 1 Then
        ActiveCell.Offset(-1, 0).Value = ActiveCell.Font.Name & " " & ActiveCell.Font.Size
    End If
End Sub

Open in new window

Make sure you are not highlighting anything on row 1, since you want the display to be above it.
0
 
Bill GoldenExecutive Managing MemberAuthor Commented:
It appears that each solution would work.  However, given that I am lost in VBA, I ended up using Martin's first solution:

Sub DisplayFont()
Range("C1") = "Font name: " & Range("C2").Font.Name & " Font Size: " & Range("C2").Font.Size
End Sub

and built it into this:

Sub DisplayFontandSizeonIncomeStatement()
Range("E61") = " " & Range("B6").Font.Name & " " & Range("B6").Font.Size
Range("E62") = " " & Range("E9").Font.Name & " " & Range("E9").Font.Size
Range("E63") = " " & Range("E10").Font.Name & " " & Range("E10").Font.Size
Range("G63") = " " & Range("G10").Font.Size
Range("J63") = " " & Range("J10").Font.Name & " " & Range("J10").Font.Size
Range("L63") = " " & Range("L10").Font.Size
Range("O63") = " " & Range("O10").Font.Size
Range("Q63") = " " & Range("Q10").Font.Size
Range("E65") = " " & Range("B69").Font.Name & " " & Range("B69").Font.Size
Range("B64") = " " & Range("B60").Font.Name & " " & Range("B60").Font.Size
Range("C64") = " " & Range("C60").Font.Size
Range("D64") = " " & Range("D60").Font.Size
Range("E64") = " " & Range("E60").Font.Name & " " & Range("E60").Font.Size
Range("G64") = " " & Range("G60").Font.Size
Range("I64") = " " & Range("I60").Font.Size
Range("J64") = " " & Range("J60").Font.Name & " " & Range("J60").Font.Size
Range("K64") = " " & Range("K60").Font.Size
Range("L64") = " " & Range("L60").Font.Size
Range("M64") = " " & Range("M60").Font.Size
Range("N64") = " " & Range("N60").Font.Size
Range("O64") = " " & Range("O60").Font.Size
Range("Q64") = " " & Range("Q60").Font.Size
End Sub

Thanks guys...
0
 
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help. My profile contains links to some articles that I've written that might interest you.

Marty - MVP 2009 to 2015
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now