LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Chart Macro Problems

Can anyone help me identify what I am doing wrong with this macro? I
am getting error message when I try to run it. It is telling me that
I am not completing the end if statement.


Sub createchart()
Dim cw As Long, rh As Long
Dim mp(1 To 4) As Integer

cw = Application.Sheets("Sheet4").Shape("Rounded Rectangle 2").Width
rh = Application.Sheets("Sheet4").Shape("Rounded Rectangle 2").Height
ct = Application.ActiveSheet.ChartObjects.Add(cw - 1, rh - 1, cw - 1,
rh - 5)
mp(1) = ActiveWorkbook.Sheets(1).Range("A22")
mp(2) = ActiveWorkbook.Sheets(1).Range("A23")
mp(3) = ActiveWorkbook.Sheets(1).Range("A24")
mp(4) = ActiveWorkbook.Sheets(1).Range("A25")

If ActiveWorkbook.Sheets(1).Range("A22") 0 Then
ct.Chart.SeriesCollection.Add _
Source:=ActiveSheet.Range("C18" + Range("A22").Value), _
SeriesLabels:=True
Else
If ActiveWorkbook.Sheets(1).Range("A23") 0 Then
ct.Chart.SeriesCollection.Add _
Source:=ActiveSheet.Range("C19" + Range("A23").Value), _
SeriesLabels:=True
Else
If ActiveWorkbook.Sheets(1).Range("A24") 0 Then
ct.Chart.SeriesCollection.Add _
Source:=ActiveSheet.Range("C20" + Range("A24").Value), _
SeriesLabels:=True
Else
If ActiveWorkbook.Sheets(1).Range("A25") 0 Then
ct.Chart.SeriesCollection.Add _
Source:=ActiveSheet.Range("C21" + Range("A25").Value), _
SeriesLabels:=True
End If
With ct
.Type = xlLine
.HasTitle = True
.chartitle.Text = "Volumes Trends"
.HasAxis(xlCategory, xlPrimary) = True
.HasAxis(xlCategory, xlSecondary) = False
.HasAxis(xlValue, xlPrimary) = False
.HasAxis(xlValue, xlSecondary) = False
End With
End Sub

 
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
Chart problems Jrf Charts and Charting in Excel 1 April 4th 10 07:01 AM
Pie Chart problems steph Charts and Charting in Excel 6 March 19th 07 12:28 PM
Chart Problems [email protected] Excel Discussion (Misc queries) 0 February 28th 06 02:03 AM
Chart problems Shel Charts and Charting in Excel 0 February 4th 06 08:59 PM
Chart problems Chris D Excel Discussion (Misc queries) 3 January 3rd 05 02:18 AM


All times are GMT +1. The time now is 10:42 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"