Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The selection was recorded as a relative reference, but the chart source
isn't. You can modify the recorded code slightly, and it will create a chart for the row you have selected in column A: '=========================== Sub Macro1() ' Dim rng As Range Dim ws As Worksheet ' Set rng = ActiveCell.Range("A1:O1") Set ws = ActiveSheet Charts.Add ActiveChart.ChartType = xlLine ActiveChart.SetSourceData _ Source:=rng, PlotBy:=xlRows ActiveChart.Location Whe=xlLocationAsObject, _ Name:=ws.Name ActiveChart.HasLegend = False End Sub '============================== wrote: Hello Debra: Here is what I got. I want to be able to place my cursor on, say, cell A1, then plot the data in cells A1 through O1. Next place the cursor on A2, and plot A2 through O2. So on, so forth. Sub Macro1() ' ' Macro1 Macro ' Macro recorded 2/2/2005 by toprak ' ' ActiveCell.Range("A1:O1").Select Charts.Add ActiveChart.ChartType = xlLine ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A2:O2"), PlotBy:= _ xlRows ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1" ActiveChart.HasLegend = False End Sub -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro relative referencing | Excel Discussion (Misc queries) | |||
Record Macro Relative does not work? | Excel Discussion (Misc queries) | |||
Record Macro Relative does not work? | Excel Discussion (Misc queries) | |||
Relative referencing | Excel Programming | |||
missing macro absolute/relative referencing toolbar | Excel Programming |