Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using VBA macro - how to just chart two selected columns
Using a VBA macro, I'm looking for the best way to Chart just the "X axis" and the "Yaxis" from selected columns. Basically, just want to chart one column vs another column located anywhere in the worksheet. Tried three ways. a) Hardcode cell address. b) Range cell selection. c) Cell address obtained from range. I believe there is a better way, but have not found it yet. Refer to code snipet ******* Range(XAXISTOPCELLGRAPH1, XAXISTOPCELLGRAPH1).Select Range(ActiveCell, ActiveCell.End(xlDown)).Select Range(YAXISTOPCELLGRAPH1, YAXISTOPCELLGRAPH1).Select Range(ActiveCell, ActiveCell.End(xlDown)).Select ' Add Chart Charts.Add ActiveChart.ChartType = xlXYScatterLinesNoMarkers ' ActiveChart.SetSourceData Source:=Sheets(DATASHEETNAME). _ ' Range("A1:A602,B1:B602") ' ActiveChart.SetSourceData Source:=Sheets(DATASHEETNAME). _ ' Range(UXCell, LYCell), PlotBy:=xlColumns ActiveChart.SetSourceData Source:=Sheets(DATASHEETNAME). _ Range(XColRange & "," & YColRange) ActiveChart.Location Whe=xlLocationAsObject, Name:= _ GRAPHSHEETNAME ******* Thanks for your help. -- RLExcelUserTS ------------------------------------------------------------------------ RLExcelUserTS's Profile: http://www.excelforum.com/member.php...o&userid=32872 View this thread: http://www.excelforum.com/showthread...hreadid=526778 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
change color to selected columns in a stacked column chart | Charts and Charting in Excel | |||
Copying selected columns from 1 chart to another. | Charts and Charting in Excel | |||
Multiple cells or columns are selected instead of selected cell or | Excel Discussion (Misc queries) | |||
A recorded Macro to hide certain selected columns hides non selec. | Excel Programming | |||
check for selected columns in a macro | Excel Programming |