CHANGING FONT SIZE

G

Guest

I have a list in excel that needs to be printed within a certain space
variable data.
Is there a way to set up a formula/macro that will change the font size if
there are more than say 60 characters but leave any less than 60 characters
the same size.
 
J

JE McGimpsey

Formulas can't change formatting such as font size.

One possibility:

Put this in the ThisWorkbook code module:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("Sheet1").Range("A1")
If Len(.Text) > 60 Then .Font.Size = 8
End With
End Sub

Change your worksheet and cell to change.
 
G

Guest

Hi JE,\
I put the code in the THISWORKBOOK MODULE.
hOW DO i MAKE IT RUN. Do I need to set up a button.
 
D

Dave Peterson

You don't need to do anything special--except allow macros when you open the
workbook.

The workbook_beforeprint will fire each time you use print or print preview.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top