View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Excel relative reference not working with charts

a macro will not select high lighted rows.
macro work outside of excel and all the built in goodies.
sorry.
you will have to tell it via code which row to select.

-----Original Message-----

Hello all,

I'm very new to making macros, so I appreciate any and

all help. I have
two tables of data on the same worksheet (e.g. one table

is the maximum
value, the other the minimum value). I want to create

a "Clustered
Column" chart that shows the progression of the min and

max values over
a series of tests. Each test is its own column, and there

are several
rows that need to be plotted. I want the macro to take

the currently
highlighted cell, and use that row to make the charts.

Here's a copy of
what I've made so far:

Sub Chart_maker()
'
' Chart_maker Macro
' This macro should create column charts based on the

currently
highlighted cell.
'

'
* ActiveCell.Offset(0, 4).Range("A1:AD1").Select
* Charts.Add
* ActiveChart.ChartType = xlColumnClustered
* ActiveChart.SetSourceData
Source:=Sheets("Sheet1").Range("E3:AH3"), _
* PlotBy:=xlRows
* ActiveChart.SeriesCollection.NewSeries
* ActiveChart.SeriesCollection(1).XValues = "='Sheet1'!

R2C5:R2C34"
* ActiveChart.SeriesCollection(1).Name = "='Sheet1'!

R1C5:R1C36"
* ActiveChart.SeriesCollection(2).Values = "='Sheet1'!

R3C37:R3C66"
* ActiveChart.SeriesCollection(2).Name = "='Sheet1'!

R1C37:R1C68"
ActiveChart.Location Whe=xlLocationAsNewSheet
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlBottom
ActiveChart.PlotArea.Select
With Selection.Border
.ColorIndex = 16
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
ActiveChart.Deselect
End Sub

The lines with asterisks are the ones where Excel is

looking at a
particular cell address, whereas I want the ones relative

to where I
started. Any help?


--
CzarCW
----------------------------------------------------------

--------------
CzarCW's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=16673
View this thread:

http://www.excelforum.com/showthread...hreadid=318880

.