LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Excel 2007: Graph macro using reletive reference?

I just gave an example of how to change the code. I didn't know how your
range was changing dynamically. You had a range of B50:H54 and my code only
had B1:B15.

The chart object on still on the worksheet. It didn't get deleted. There
is just no data to fill the chart so it became invisible.

"Abel MacAdam" wrote:

Hi Joel,

Thanks for helping me. Sadly, no. The graph is wiped clean. The range it
uses for its data is altered to a location containing no data. Even a 'Undo'
did not get me my data back.

Abel

"Joel" wrote:

Something like this


Sub Past_month_click()
LastRow = 15
Set MyRange = Range("B1:B" & LastRow)
'
ActiveSheet.ChartObjects("Graph 15").Activate
ActiveChart.SetSourceData Source:=MyRange
End Sub


"Abel MacAdam" wrote:

Hi,

I recorded the following macro:
Sub Past_month_click()
'
ActiveSheet.ChartObjects("Graph 15").Activate
ActiveSheet.ChartObjects("Graph 15").Activate
ActiveChart.SetSourceData Source:=Range("B50:H54")
End Sub

What do I want to accomplish? I have a range of data per month. When I do my
thing in the sheet I want to add the last month to my graph. In Excel I have
to right click the graph, change the data range, press the right key,
followed by pressing the Enter key. This I would like to do by the macro. So,
the Range("B50:H54") must become a relative reference. What do I need to
change in the above code to accomplish that?

Abel



 
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
Macro Cell Reference - Excel 2007 JohnH Excel Discussion (Misc queries) 0 March 3rd 08 02:42 PM
Reletive Referencing - Marco issues [email protected] Excel Programming 3 October 12th 07 05:12 PM
Transpose Reletive Cell References? Conan Kelly Excel Worksheet Functions 1 January 12th 06 04:45 PM
paste reletive reference in pivot table ReneeR Excel Discussion (Misc queries) 0 December 5th 05 10:36 PM
Reletive Referencing of Another Cell's Formulas Damian Excel Programming 2 January 14th 05 02:31 AM


All times are GMT +1. The time now is 06:11 PM.

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

About Us

"It's about Microsoft Excel"