Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.charting
|
|||
|
|||
Change chart range with macro
Greetings. I am trying to name a variable that is the last row of data in a
range, then use that variable in a chart's range. I tried inserting it where the last row would be, but it is not working, like this "A20:A & LstRow,... Anyone have any ideas? LstRow = [B51].End(xlUp).Row MsgBox (LstRow) Charts.Add ActiveChart.ChartType = xlLine ActiveChart.SetSourceData Source:=Sheets("Mar").Range( _ "A20:A & LstRow,C20:C46,E20:E46,G20:G46,I20:I46,K20:K46,M20 :M46"), PlotBy:=xlColumns ActiveChart.Location Whe=xlLocationAsObject, Name:="Mar" ActiveChart.HasLegend = True ActiveChart.Legend.Select Selection.Position = xlRight |
#2
Posted to microsoft.public.excel.charting
|
|||
|
|||
Change chart range with macro
Ok, I got it. It should be like this RANGE("A20:A" & LstRow & ",C20:...
"Greg Snidow" wrote: Greetings. I am trying to name a variable that is the last row of data in a range, then use that variable in a chart's range. I tried inserting it where the last row would be, but it is not working, like this "A20:A & LstRow,... Anyone have any ideas? LstRow = [B51].End(xlUp).Row MsgBox (LstRow) Charts.Add ActiveChart.ChartType = xlLine ActiveChart.SetSourceData Source:=Sheets("Mar").Range( _ "A20:A & LstRow,C20:C46,E20:E46,G20:G46,I20:I46,K20:K46,M20 :M46"), PlotBy:=xlColumns ActiveChart.Location Whe=xlLocationAsObject, Name:="Mar" ActiveChart.HasLegend = True ActiveChart.Legend.Select Selection.Position = xlRight |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Use a combo to change the data range for a chart? | Excel Discussion (Misc queries) | |||
A copy of a chart doesn't change when the original has new range | Charts and Charting in Excel | |||
trying to programmatically change chart data range with vb.net | Charts and Charting in Excel | |||
How to dynamically change the series range of a chart ? | Charts and Charting in Excel | |||
Macro to change Chart Range when inserting a column | Charts and Charting in Excel |