Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default VB Macro to Create a Chart

I've been using this code for a while to easily create a new chart.
However just recently has stopped working. It now created a "default"
excel chart as a new tab in the workbook. Any suggestions?

'************************************************* *******************
'Creates 2 data series horizontal bar chart
'************************************************* *******************

Dim myShtName As String
myShtName = ActiveSheet.Name
Charts.Add
ActiveChart.ChartType = xlBarClustered 'Creates Stacked bar
ActiveChart.SetSourceData Source:=Rng, PlotBy:=xlColumns
'References sheet and and cell range of data to generate chart
ActiveChart.Location Whe=xlLocationAsObject, Name:=myShtName
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
ActiveChart.HasLegend = True


'************************************************* *******************
'Specifies placement and height & width dimensions of chart
'************************************************* *******************

With ActiveChart.Parent
.Top = ActiveSheet.Range("F22:Q22").Top
.Left = ActiveSheet.Range("F22:Q52").Left
.Height = ActiveSheet.Range("F22:Q52").Height
.Width = ActiveSheet.Range("F22:Q22").Width
End With

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
Trying to Create a Macro [email protected] Excel Worksheet Functions 1 July 27th 06 10:03 PM
Using a macro to create a macro in another workbook Gizmo63 Excel Worksheet Functions 2 May 15th 06 09:48 AM
Macro to change Chart Range when inserting a column Mark Charts and Charting in Excel 1 September 13th 05 01:12 PM
How do I create a "backwards" chart Sarah Charts and Charting in Excel 2 March 31st 05 05:08 AM
Macro to create macro Carl Bowman Excel Discussion (Misc queries) 2 February 6th 05 10:49 AM


All times are GMT +1. The time now is 04:27 PM.

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"