Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
flow23
 
Posts: n/a
Default chart MAcro to change on activecell

Here is the macro below.. The only problem is that the columns change every
month. so range (columns)keeps widening.... I have sorted it by selecting
range upto column N. so it is provided for all 12 months.
But now the "Grand total" column which is always the last column also gets
included..(.which shouldnt be included in the range for the chart)

Is there a way to modify this macro ?

Sub updatechart1()
Dim ThechartObj As ChartObject
Dim Thechart As Chart
Dim Userrow As Long
Dim CatTitles As Range
Dim SrcRange As Range
Dim SourceData As Range

If Sheets("summary").CheckBox1 Then
Set ThechartObj = ActiveSheet.ChartObjects(1)
Set Thechart = ThechartObj.Chart
Userrow = ActiveCell.Row

If Userrow < 20 Or IsEmpty(Cells(Userrow, 1)) Then
ThechartObj.Visible = False

Else

Set CatTitles = Range("A20:N20")
Set SrcRange = Range(Cells(Userrow, 1), _
Cells(Userrow, 14))

Set SourceData = Union(CatTitles, SrcRange)
Thechart.SetSourceData _
Source:=SourceData, PlotBy:=xlRows

Thechart.SeriesCollection(1).XValues = "=summary!R20C2:R20C14"


ThechartObj.Visible = True
End If
End If

End Sub
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
Macro fails in Pie Chart - Can Microsoft / MVP please comment Jay Charts and Charting in Excel 2 November 19th 05 12:28 PM
How do I change the colors of each slice in a pie chart easily? GundyUrgie Charts and Charting in Excel 1 November 3rd 05 03:10 AM
How to change Series order in a Combination Chart? vrk1 Charts and Charting in Excel 3 April 1st 05 07:21 AM
how do i change the expense statement template macro Mad2691 Excel Worksheet Functions 1 January 28th 05 01:21 PM
Where to stick macro to change default comment font? [email protected] Excel Discussion (Misc queries) 1 January 1st 05 12:57 AM


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

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"