Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro fails in Pie Chart - Can Microsoft / MVP please comment | Charts and Charting in Excel | |||
How do I change the colors of each slice in a pie chart easily? | Charts and Charting in Excel | |||
How to change Series order in a Combination Chart? | Charts and Charting in Excel | |||
how do i change the expense statement template macro | Excel Worksheet Functions | |||
Where to stick macro to change default comment font? | Excel Discussion (Misc queries) |