LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Modifying chart source range using variable

I know there have been previous posts on this but I am relatively new
to VBA and am having trouble adapting it to my needs.

I currently have a workbook that is charting a trend of data verses
time. Every month we dump in more data and refresh the pivot tables
that sort it out. The charts are all on one sheet and the pivot
tables are spread out throughout different sheets. I am currently
trying to make a macro that will automatically adjust the source data
to include new data every month by using the COUNTA function to set
the amount of rows included in the chart. I would also like it to
only use a max of 48 months (48 rows) but I cant work that out later.

Right now I have the following:(primarily from boards I've read-
explanations/efforts in caps)

Sub Macro1()

Dim rng As Range

Set rng = Range("C6:C27").Offset(Range("DO2").Value, 0) (' I HAVE A
COUNTA FUNTION HERE THAT TELLS HOW MANY ROWS ARE USED)

Sheets("Sheet3").Select '(THIS IS WHERE SOURCE DATA IS)

sRange = "='" & ActiveSheet.Name & "'!" & rng.Address(1, 1, xlR6C3)
(THIS PART STUMPS ME BUT DATA STARTS ON ROW6 AND COLUMN 3)

Sheets("Charts").Select

ActiveSheet.ChartObjects("Chart 2").Chart.SeriesCollection(1).Values =
sRange (THIS IS WHERE I GET RUN TIME ERROR "UNABLE TO SET VALUES
PROPERTY OF SERIES CLASS)

END SUB
--------------------------------------------------------
Any help is appreciated!

 
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
Modifying ODBC data source for multiple reports erick-flores Excel Programming 5 February 6th 07 08:10 PM
Accessing a variable(a range) and modifying it James Cornthwaite Excel Programming 1 May 30th 06 11:01 PM
Chart: Use range name for source data sk[_2_] Excel Programming 2 July 6th 05 08:17 PM
Chart source data range Don Rouse Excel Programming 2 March 23rd 05 06:17 PM
Setting Source Range For Chart James Stephens Excel Programming 4 March 4th 04 11:01 PM


All times are GMT +1. The time now is 08:53 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"