View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Font enlarge/reduce by 1 pt?

You can use code like the following:

Sub ChangeFontSize()

Dim Res As VbMsgBoxResult
Dim R As Range
Dim N As Long

Res = MsgBox("Do you want to increase the size of the font?" & vbCrLf & _
"Click 'Yes' to enlarge the size of the font by one point." & vbCrLf & _
"Click 'No' to reduce the size of the font by one point." & vbCrLf & _
"Click 'Cancel' to terminate the operation.", vbYesNoCancel)

Select Case Res
Case vbYes
N = 1
Case vbNo
N = -1
Case Else
Exit Sub
End Select

If TypeOf Selection Is Excel.Range Then
For Each R In Selection.Cells
With R.Font
.Size = .Size + N
End With
Next R
End If

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"StargateFanFromWork" wrote in message
...
Is there syntax for reducing and enlarging font by 1 pt? What I mean by
that is so that if font in cell is 10pt, by clicking enlarge font by 1 pt,
it would increase to 11pt, and it we clicked again it would go to 12pt?

And the opposite, syntax to do "-1" point?

Thanks. :oD