Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Multiple font sizes in a single cell

Hi everyone.

OK, so I know you can set and get the font size of a cell in Excel by using
Cell.Font.Size, but if there are multiple font sizes (some of the text in
the cell at 12pt and some at 10pt in the same cell), Cell.Font.Size returns
a Null value. Is there anyway to get the different font sizes out of a
single cell?

TIA for any help.
-Pete
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Multiple font sizes in a single cell

Hi Pete,

Here's a stab at it but it may not be what you are looking for. You
probably want the code to spit out the different font sizes. With these two
subs you have to set the Start and Length components

Where F2 has seven characters and the first 3 are one font size and the next
four are another.

Sub FontSize()
Dim i As Integer
Dim j As Integer
Range("F2").Select
i = ActiveCell.Characters(Start:=1, Length:=3).Font.Size
j = ActiveCell.Characters(Start:=4, Length:=4).Font.Size
MsgBox i & " " & j
End Sub

With this sub you set the Start and Length in cells F1 & G1.

Sub FontSizeToo()
Dim i As Integer
Dim s As Integer
Dim l As Integer

s = Range("F1").Value
l = Range("G1").Value

Range("F2").Select
i = ActiveCell.Characters(Start:=s, Length:=l).Font.Size
MsgBox i
End Sub

HTH
Regards,
Howard

"Pete" wrote in message
. ..
Hi everyone.

OK, so I know you can set and get the font size of a cell in Excel by
using
Cell.Font.Size, but if there are multiple font sizes (some of the text in
the cell at 12pt and some at 10pt in the same cell), Cell.Font.Size
returns
a Null value. Is there anyway to get the different font sizes out of a
single cell?

TIA for any help.
-Pete



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Multiple font sizes in a single cell

Thanks Howard,

That at least sends me in the right direction. However, I won't know the
start and end points where the font size changes, so I'll probably have to
do some kind of Do Until loop on the characters to determine the different
start and end positions for the different font sizes.

Thanks for your help!

-Pete

Hi Pete,

Here's a stab at it but it may not be what you are looking for. You
probably want the code to spit out the different font sizes. With these two
subs you have to set the Start and Length components

Where F2 has seven characters and the first 3 are one font size and the next
four are another.

Sub FontSize()
Dim i As Integer
Dim j As Integer
Range("F2").Select
i = ActiveCell.Characters(Start:=1, Length:=3).Font.Size
j = ActiveCell.Characters(Start:=4, Length:=4).Font.Size
MsgBox i & " " & j
End Sub

With this sub you set the Start and Length in cells F1 & G1.

Sub FontSizeToo()
Dim i As Integer
Dim s As Integer
Dim l As Integer

s = Range("F1").Value
l = Range("G1").Value

Range("F2").Select
i = ActiveCell.Characters(Start:=s, Length:=l).Font.Size
MsgBox i
End Sub

HTH
Regards,
Howard

"Pete" wrote in message
. ..
Hi everyone.

OK, so I know you can set and get the font size of a cell in Excel by
using
Cell.Font.Size, but if there are multiple font sizes (some of the text in
the cell at 12pt and some at 10pt in the same cell), Cell.Font.Size
returns
a Null value. Is there anyway to get the different font sizes out of a
single cell?

TIA for any help.
-Pete

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 698
Default Multiple font sizes in a single cell

That's what I thought, and I did kick around trying to count how many of a
particular font size was in a cell, and it worked, but again, had to set the
Start and Length. If you could get past that I think your home free.

Good luck,
Regards,
Howard

"Pete" wrote in message
. ..
Hi everyone.

OK, so I know you can set and get the font size of a cell in Excel by
using
Cell.Font.Size, but if there are multiple font sizes (some of the text in
the cell at 12pt and some at 10pt in the same cell), Cell.Font.Size
returns
a Null value. Is there anyway to get the different font sizes out of a
single cell?

TIA for any help.
-Pete



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change all text one font size up with various font sizes used. omchrystal New Users to Excel 2 March 6th 07 09:01 PM
Is it possible to format a cell w/ 2 font sizes by formula? The Beef Excel Worksheet Functions 2 July 11th 06 09:44 PM
Can you mix font sizes in a cell? Marc New Users to Excel 5 April 11th 05 09:47 PM
Mixing Font Sizes In A Cell Formula Minitman Excel Worksheet Functions 2 November 11th 04 03:40 PM
Font Sizes S. S. Excel Programming 0 January 14th 04 08:05 PM


All times are GMT +1. The time now is 02:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"