PC Review


Reply
Thread Tools Rate Thread

Creating Chart Dynamically (It is Driving Me Nuts)

 
 
Ardy
Guest
Posts: n/a
 
      20th Dec 2006
OK, I admit I am not a programmer, but god knows I am trying. I am
trying to create a chart via a command button and it works but every
time I activate it, it gives me the same dam chart.
I change some data point and re activate same chart again and it drops
the series name also, can some body give me some insight. I have
formulated the code below with macros that I cleaned up.
------------------------------------------------
Sub ConceptPrintChart()
' Create Chart Concepts About Print
' Ardy
' 12/12/2006

ClearCharts
Application.ScreenUpdating = False
Charts.Add
ActiveChart.Location Where:=xlLocationAsObject, Name:="Roster"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=Roster!R2C1:R43C1"
ActiveChart.SeriesCollection(1).Values = "=Roster!R2C3:R43C3"
ActiveChart.SeriesCollection(1).Name = "=Roster!R1C3"
ActiveChart.SeriesCollection(2).Values = "=Roster!R2C4:R43C4"
ActiveChart.SeriesCollection(2).Name = "=Roster!R1C4"
With ActiveChart
.SetSourceData Range("A243")
.HasTitle = True
.ChartType = xlColumnClustered
.HasLegend = False
.ApplyDataLabels Type:=xlDataLabelsShowValue
.Axes(xlCategory).TickLabels.Orientation = xlHorizontal
.ChartTitle.Font.Bold = True
.ChartTitle.Font.Size = 12
.PlotArea.Top = 18
.PlotArea.Height = 162
.Axes(xlValue).MaximumScale = 0.6
.Deselect'End With
.HasTitle = True
.ChartTitle.Characters.Text = "Title Here"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlBottom
ActiveChart.HasDataTable = False
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 7
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 7
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ResizeChart
Application.ScreenUpdating = True
Range("C1").Select
Application.ScreenUpdating = True
End Sub

 
Reply With Quote
 
 
 
 
Spreadsheet Solutions
Guest
Posts: n/a
 
      20th Dec 2006
Ardy;

Try creating a dynamic chart this way:
http://www.rosenkrantz.nl/charttip03.htm

--
--
Mark Rosenkrantz
--
Spreadsheet Solutions
Witkopeend 24
1423 SN, Uithoorn
Netherlands
--
W: www.rosenkrantz.nl
E: (E-Mail Removed)
--
"Ardy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> OK, I admit I am not a programmer, but god knows I am trying. I am
> trying to create a chart via a command button and it works but every
> time I activate it, it gives me the same dam chart.
> I change some data point and re activate same chart again and it drops
> the series name also, can some body give me some insight. I have
> formulated the code below with macros that I cleaned up.
> ------------------------------------------------
> Sub ConceptPrintChart()
> ' Create Chart Concepts About Print
> ' Ardy
> ' 12/12/2006
>
> ClearCharts
> Application.ScreenUpdating = False
> Charts.Add
> ActiveChart.Location Where:=xlLocationAsObject, Name:="Roster"
> ActiveChart.SeriesCollection.NewSeries
> ActiveChart.SeriesCollection(1).XValues = "=Roster!R2C1:R43C1"
> ActiveChart.SeriesCollection(1).Values = "=Roster!R2C3:R43C3"
> ActiveChart.SeriesCollection(1).Name = "=Roster!R1C3"
> ActiveChart.SeriesCollection(2).Values = "=Roster!R2C4:R43C4"
> ActiveChart.SeriesCollection(2).Name = "=Roster!R1C4"
> With ActiveChart
> .SetSourceData Range("A243")
> .HasTitle = True
> .ChartType = xlColumnClustered
> .HasLegend = False
> .ApplyDataLabels Type:=xlDataLabelsShowValue
> .Axes(xlCategory).TickLabels.Orientation = xlHorizontal
> .ChartTitle.Font.Bold = True
> .ChartTitle.Font.Size = 12
> .PlotArea.Top = 18
> .PlotArea.Height = 162
> .Axes(xlValue).MaximumScale = 0.6
> .Deselect'End With
> .HasTitle = True
> .ChartTitle.Characters.Text = "Title Here"
> .Axes(xlCategory, xlPrimary).HasTitle = False
> .Axes(xlValue, xlPrimary).HasTitle = False
> End With
> ActiveChart.HasLegend = True
> ActiveChart.Legend.Select
> Selection.Position = xlBottom
> ActiveChart.HasDataTable = False
> ActiveChart.Axes(xlCategory).Select
> Selection.TickLabels.AutoScaleFont = True
> With Selection.TickLabels.Font
> .Name = "Arial"
> .FontStyle = "Regular"
> .Size = 7
> .Strikethrough = False
> .Superscript = False
> .Subscript = False
> .OutlineFont = False
> .Shadow = False
> .Underline = xlUnderlineStyleNone
> .ColorIndex = xlAutomatic
> .Background = xlAutomatic
> End With
> ActiveChart.Axes(xlValue).Select
> Selection.TickLabels.AutoScaleFont = True
> With Selection.TickLabels.Font
> .Name = "Arial"
> .FontStyle = "Regular"
> .Size = 7
> .Strikethrough = False
> .Superscript = False
> .Subscript = False
> .OutlineFont = False
> .Shadow = False
> .Underline = xlUnderlineStyleNone
> .ColorIndex = xlAutomatic
> .Background = xlAutomatic
> End With
> ResizeChart
> Application.ScreenUpdating = True
> Range("C1").Select
> Application.ScreenUpdating = True
> End Sub
>



 
Reply With Quote
 
Ardy
Guest
Posts: n/a
 
      20th Dec 2006
Thanks.....
I incorporated some of codes from your link....Intreasting. I finally
got the dam thing to work.....

Ardy
Spreadsheet Solutions wrote:
> Ardy;
>
> Try creating a dynamic chart this way:
> http://www.rosenkrantz.nl/charttip03.htm
>
> --
> --
> Mark Rosenkrantz
> --
> Spreadsheet Solutions
> Witkopeend 24
> 1423 SN, Uithoorn
> Netherlands
> --
> W: www.rosenkrantz.nl
> E: (E-Mail Removed)
> --
> "Ardy" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > OK, I admit I am not a programmer, but god knows I am trying. I am
> > trying to create a chart via a command button and it works but every
> > time I activate it, it gives me the same dam chart.
> > I change some data point and re activate same chart again and it drops
> > the series name also, can some body give me some insight. I have
> > formulated the code below with macros that I cleaned up.
> > ------------------------------------------------
> > Sub ConceptPrintChart()
> > ' Create Chart Concepts About Print
> > ' Ardy
> > ' 12/12/2006
> >
> > ClearCharts
> > Application.ScreenUpdating = False
> > Charts.Add
> > ActiveChart.Location Where:=xlLocationAsObject, Name:="Roster"
> > ActiveChart.SeriesCollection.NewSeries
> > ActiveChart.SeriesCollection(1).XValues = "=Roster!R2C1:R43C1"
> > ActiveChart.SeriesCollection(1).Values = "=Roster!R2C3:R43C3"
> > ActiveChart.SeriesCollection(1).Name = "=Roster!R1C3"
> > ActiveChart.SeriesCollection(2).Values = "=Roster!R2C4:R43C4"
> > ActiveChart.SeriesCollection(2).Name = "=Roster!R1C4"
> > With ActiveChart
> > .SetSourceData Range("A243")
> > .HasTitle = True
> > .ChartType = xlColumnClustered
> > .HasLegend = False
> > .ApplyDataLabels Type:=xlDataLabelsShowValue
> > .Axes(xlCategory).TickLabels.Orientation = xlHorizontal
> > .ChartTitle.Font.Bold = True
> > .ChartTitle.Font.Size = 12
> > .PlotArea.Top = 18
> > .PlotArea.Height = 162
> > .Axes(xlValue).MaximumScale = 0.6
> > .Deselect'End With
> > .HasTitle = True
> > .ChartTitle.Characters.Text = "Title Here"
> > .Axes(xlCategory, xlPrimary).HasTitle = False
> > .Axes(xlValue, xlPrimary).HasTitle = False
> > End With
> > ActiveChart.HasLegend = True
> > ActiveChart.Legend.Select
> > Selection.Position = xlBottom
> > ActiveChart.HasDataTable = False
> > ActiveChart.Axes(xlCategory).Select
> > Selection.TickLabels.AutoScaleFont = True
> > With Selection.TickLabels.Font
> > .Name = "Arial"
> > .FontStyle = "Regular"
> > .Size = 7
> > .Strikethrough = False
> > .Superscript = False
> > .Subscript = False
> > .OutlineFont = False
> > .Shadow = False
> > .Underline = xlUnderlineStyleNone
> > .ColorIndex = xlAutomatic
> > .Background = xlAutomatic
> > End With
> > ActiveChart.Axes(xlValue).Select
> > Selection.TickLabels.AutoScaleFont = True
> > With Selection.TickLabels.Font
> > .Name = "Arial"
> > .FontStyle = "Regular"
> > .Size = 7
> > .Strikethrough = False
> > .Superscript = False
> > .Subscript = False
> > .OutlineFont = False
> > .Shadow = False
> > .Underline = xlUnderlineStyleNone
> > .ColorIndex = xlAutomatic
> > .Background = xlAutomatic
> > End With
> > ResizeChart
> > Application.ScreenUpdating = True
> > Range("C1").Select
> > Application.ScreenUpdating = True
> > End Sub
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
This is driving me nuts Alan H Windows XP Video 4 31st Mar 2006 04:35 AM
PIE/BAR CHART QUESTIONS?(creating them dynamically) =?Utf-8?B?UGF0cmljay5PLklnZQ==?= Microsoft ASP .NET 10 27th Nov 2005 08:40 PM
xp sp2 driving me NUTS Emil Windows XP Help 4 8th Dec 2004 06:00 PM
driving me nuts Windows XP Performance 3 21st Jan 2004 03:05 PM
it's driving me nuts sabra Windows XP General 3 31st Dec 2003 08:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:57 AM.