Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Change datalabel font size for all chartobjects in a row

Hi,

John or any other,
This is a sub for changing all datalabel font sizes in all chartobjects in a
worksheet.

I get error like "Size method not allowed by Font object" for this code. Can
sombodey help me?

/Regards

-----
"John Green" skrev i meddelandet
...
Try the following:


Sub SetFonts()
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim chtobj As ChartObject
Dim scol As Series
Dim dl As DataLabel
For Each chtobj In ActiveSheet.ChartObjects
For Each scol In chtobj.Chart.SeriesCollection
For Each dl In scol.datalabels
With dl.Font
.Name = "Arial"
.FontStyle = "Fet"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.Background = xlTransparent
End With
With dl
.NumberFormat = "#,##0"
.AutoScaleFont = True
End With
Next
Next
Next
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub



John Green
Sydney
Australia


"Marie J-son" wrote in message
...
Hi,
This Sub doesn't work (why?)

I have a number of chartobjects with different numbers of datalabels and
seriecollections. How can I change font size for all charts and
datalabels
in seriescollections all in a row?

Sub SetFonts()
Dim chtobj As ChartObjects
Dim scol As SeriesCollection
Dim dl As DataLabel
For Each chtobj In ActiveSheet
For Each scol In chtobj
For Each dl In scol
With dl.Font
.Name = "Arial"
.FontStyle = "Fet"
.Size = 16
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
.NumberFormat = "#,##0"
.AutoScaleFont = True
End With
Next
Next
Next
End Sub


Kind regards






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Further info: Loop never leave first chartobject...

Further information:
I put a msgbox the line before "With dl.Font" to tell the name of the
activeChart and then I see that the loop never leave the first
activechart...

/regards


"Marie J-son" skrev i meddelandet
...
Hi,

John or any other,
This is a sub for changing all datalabel font sizes in all chartobjects in
a worksheet.

I get error like "Size method not allowed by Font object" for this code.
Can sombodey help me?

/Regards

-----
"John Green" skrev i meddelandet
...
Try the following:


Sub SetFonts()
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim chtobj As ChartObject
Dim scol As Series
Dim dl As DataLabel
For Each chtobj In ActiveSheet.ChartObjects
For Each scol In chtobj.Chart.SeriesCollection
For Each dl In scol.datalabels
With dl.Font
.Name = "Arial"
.FontStyle = "Fet"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.Background = xlTransparent
End With
With dl
.NumberFormat = "#,##0"
.AutoScaleFont = True
End With
Next
Next
Next
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub



John Green
Sydney
Australia


"Marie J-son" wrote in message
...
Hi,
This Sub doesn't work (why?)

I have a number of chartobjects with different numbers of datalabels and
seriecollections. How can I change font size for all charts and
datalabels
in seriescollections all in a row?

Sub SetFonts()
Dim chtobj As ChartObjects
Dim scol As SeriesCollection
Dim dl As DataLabel
For Each chtobj In ActiveSheet
For Each scol In chtobj
For Each dl In scol
With dl.Font
.Name = "Arial"
.FontStyle = "Fet"
.Size = 16
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
.NumberFormat = "#,##0"
.AutoScaleFont = True
End With
Next
Next
Next
End Sub


Kind regards








  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Change datalabel font size for all chartobjects in a row

Got some answer on this in the excel.charting group
/



"Marie J-son" skrev i meddelandet
...
Hi,

John or any other,
This is a sub for changing all datalabel font sizes in all chartobjects in
a worksheet.

I get error like "Size method not allowed by Font object" for this code.
Can sombodey help me?

/Regards

-----
"John Green" skrev i meddelandet
...
Try the following:


Sub SetFonts()
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim chtobj As ChartObject
Dim scol As Series
Dim dl As DataLabel
For Each chtobj In ActiveSheet.ChartObjects
For Each scol In chtobj.Chart.SeriesCollection
For Each dl In scol.datalabels
With dl.Font
.Name = "Arial"
.FontStyle = "Fet"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.Background = xlTransparent
End With
With dl
.NumberFormat = "#,##0"
.AutoScaleFont = True
End With
Next
Next
Next
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub



John Green
Sydney
Australia


"Marie J-son" wrote in message
...
Hi,
This Sub doesn't work (why?)

I have a number of chartobjects with different numbers of datalabels and
seriecollections. How can I change font size for all charts and
datalabels
in seriescollections all in a row?

Sub SetFonts()
Dim chtobj As ChartObjects
Dim scol As SeriesCollection
Dim dl As DataLabel
For Each chtobj In ActiveSheet
For Each scol In chtobj
For Each dl In scol
With dl.Font
.Name = "Arial"
.FontStyle = "Fet"
.Size = 16
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
.NumberFormat = "#,##0"
.AutoScaleFont = True
End With
Next
Next
Next
End Sub


Kind regards








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
DataLabel.Font.ColorIndex vs DataLabel.Text (Private Sub does not work in excel 2003) God Itself Charts and Charting in Excel 4 April 22nd 09 03:40 PM
change font size on screen, but prints in old size lvrcdval Excel Discussion (Misc queries) 2 July 19th 07 02:36 PM
Change all text one font size up with various font sizes used. omchrystal New Users to Excel 2 March 6th 07 09:01 PM
Change datalabel font size for all chartobjects in a row Marie J-son Charts and Charting in Excel 2 December 5th 04 07:02 PM
set datalabel font size for all charts in a row Marie J-son[_4_] Excel Programming 1 November 19th 04 03:18 AM


All times are GMT +1. The time now is 12:52 AM.

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

About Us

"It's about Microsoft Excel"