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 Cycle through all the available Fonts

Scott,

Try something like


Dim CBX As Office.CommandBarComboBox
Dim Ndx As Long
Set CBX = Application.CommandBars.FindControl(ID:=1728)
For Ndx = 1 To CBX.ListCount
Cells(Ndx, 1).Value = CBX.List(Ndx)
Cells(Ndx, 2).Value = CBX.List(Ndx)
Cells(Ndx, 2).Font.Name = CBX.List(Ndx)
Next Ndx



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Scott Riddle" wrote in message
om...
I would like to be able to take a list of the same phrase and

assign a
different font to each line. I am trying to see what the text

would
look like with each font. My problem is I do not know how to

refer to
each font other than by name. It cant just use

selection.font.name=1
and so on. Is there some way to refer to a font other than by

name?

Thanks
Scott

Sub font()
I = 1
For Each cell In Selection
cell.font.Name = I
Cells(cell.Row, cell.Column + 1) = cell.font.Name
I = I + 1
Next cell

End Sub