Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel relative reference not working with charts


Hello all,

I'm very new to making macros, so I appreciate any and all help. I hav
two tables of data on the same worksheet (e.g. one table is the maximu
value, the other the minimum value). I want to create a "Clustere
Column" chart that shows the progression of the min and max values ove
a series of tests. Each test is its own column, and there are severa
rows that need to be plotted. I want the macro to take the currentl
highlighted cell, and use that row to make the charts. Here's a copy o
what I've made so far:

Sub Chart_maker()
'
' Chart_maker Macro
' This macro should create column charts based on the currentl
highlighted cell.
'

'
* ActiveCell.Offset(0, 4).Range("A1:AD1").Select
* Charts.Add
* ActiveChart.ChartType = xlColumnClustered
* ActiveChart.SetSourceDat
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
particular cell address, whereas I want the ones relative to where
started. Any help

--
CzarC
-----------------------------------------------------------------------
CzarCW's Profile: http://www.excelforum.com/member.php...fo&userid=1667
View this thread: http://www.excelforum.com/showthread.php?threadid=31888

  #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

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Relative Addressing not working PocketRocket Excel Worksheet Functions 4 October 22nd 09 07:10 PM
Can you change the relative reference of a cell in an Excel formul Rod Bowyer Excel Discussion (Misc queries) 4 July 14th 07 01:22 AM
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Relative Reference Hari Excel Discussion (Misc queries) 4 October 26th 05 02:00 AM
Recording new excel macro, relative reference button doesn't show Dano New Users to Excel 3 August 23rd 05 07:36 PM


All times are GMT +1. The time now is 03:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"