Unable to set the Values property of the Series class #2

I'm working on a macro to get a chart from a dynamic range of cells 
(selected according to the date introduced for the user in the worksheet). 
The problem is that I store the selected range of values in variant vectors 
(1D arrays), as decimal types. In the below code these arrays are called 
PVAC, SRDM, ISRM and TimeData. With some range the code works, but with the 
most of them it doesn't it. Any idea? thank you 

'-------------------------------
'To put the Chosen Range of Data in arrays
'Selected Data into vectors

RangeSize = endRow - starRow + 1 'Size of the Range of choosen Data

ReDim PVAC(RangeSize) 'vector size
ReDim SRDM(RangeSize) 'vector size
ReDim ISRM(RangeSize) 'vector size
ReDim TimeData(RangeSize) 'vector size
k = 0
Do Until (k = RangeSize)
    PVAC(k) = CDec(Sheets("Alldata2").Cells(starRow + k, 14))
    SRDM(k) = CDec(Sheets("Alldata2").Cells(starRow + k, 15))
    ISRM(k) = CDec(Sheets("Alldata2").Cells(starRow + k, 16))
    TimeData(k) = CDec(Sheets("Alldata2").Cells(starRow + k, 6))
    k = k + 1
Loop
ReDim Preserve PVAC(RangeSize - 1)
ReDim Preserve SRDM(RangeSize - 1)
ReDim Preserve ISRM(RangeSize - 1)
ReDim Preserve TimeData(RangeSize - 1)


'----------------------------------------------
'Chart from the Selected Data
Charts.Add
    ActiveChart.ChartType = xlXYScatterSmooth
    'All de data as Range of Data
    ActiveChart.SetSourceData Source:=Sheets("ALLDATA2").Range("N3:P14575"), 
PlotBy:=xlColumns
    'Display the first serie
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(1).XValues = TimeData
    ActiveChart.SeriesCollection(1).Values = PVAC
    ActiveChart.SeriesCollection(1).Name = "=ALLDATA2!R2C14"
    'Display the second serie
    ActiveChart.SeriesCollection(2).XValues = TimeData
    ActiveChart.SeriesCollection(2).Values = SRDM
    ActiveChart.SeriesCollection(2).Name = "=ALLDATA2!R2C15"
   'Display the third serie
    ActiveChart.SeriesCollection(3).XValues = TimeData
    ActiveChart.SeriesCollection(3).Values = ISRM
    ActiveChart.SeriesCollection(3).Name = "=ALLDATA2!R2C16"
0
troncho (1)
9/25/2006 3:21:30 PM
excel.charting 18370 articles. 0 followers. Follow

1 Replies
248 Views

Similar Articles

[PageSpeed] 53

Hi,

If you are using values rather than cell references you are no doubt 
hitting the limit for the series formula length, which is about 1024 
characters.

So a series formula references 4 rows looks like this
=SERIES(,Sheet1!$B$3:$B$6,Sheet1!$C$3:$C$6,1)

but when using an array of values looks like this
=SERIES(,{"a","b","c","d"},{1,2,3,4},1)

if you extend the range to row 43 the formula looks more like this
=SERIES(,Sheet1!$B$3:$B$43,{1,2,3,4,1,5,6,7,1,8,9,10,1,11,12,13,1,14,15,16,1,17,18,19,1,20,21,22,1,23,24,25,1,26,27,28,1,29,30,31,1,0,0},1)

And as you appear to be going to row 14575 the formula is going to be 
too long. You will hit the limit a lot sooner if you have floating point 
values.

Cheers
Andy

rafael garcia wrote:
> I'm working on a macro to get a chart from a dynamic range of cells 
> (selected according to the date introduced for the user in the worksheet). 
> The problem is that I store the selected range of values in variant vectors 
> (1D arrays), as decimal types. In the below code these arrays are called 
> PVAC, SRDM, ISRM and TimeData. With some range the code works, but with the 
> most of them it doesn't it. Any idea? thank you 
> 
> '-------------------------------
> 'To put the Chosen Range of Data in arrays
> 'Selected Data into vectors
> 
> RangeSize = endRow - starRow + 1 'Size of the Range of choosen Data
> 
> ReDim PVAC(RangeSize) 'vector size
> ReDim SRDM(RangeSize) 'vector size
> ReDim ISRM(RangeSize) 'vector size
> ReDim TimeData(RangeSize) 'vector size
> k = 0
> Do Until (k = RangeSize)
>     PVAC(k) = CDec(Sheets("Alldata2").Cells(starRow + k, 14))
>     SRDM(k) = CDec(Sheets("Alldata2").Cells(starRow + k, 15))
>     ISRM(k) = CDec(Sheets("Alldata2").Cells(starRow + k, 16))
>     TimeData(k) = CDec(Sheets("Alldata2").Cells(starRow + k, 6))
>     k = k + 1
> Loop
> ReDim Preserve PVAC(RangeSize - 1)
> ReDim Preserve SRDM(RangeSize - 1)
> ReDim Preserve ISRM(RangeSize - 1)
> ReDim Preserve TimeData(RangeSize - 1)
> 
> 
> '----------------------------------------------
> 'Chart from the Selected Data
> Charts.Add
>     ActiveChart.ChartType = xlXYScatterSmooth
>     'All de data as Range of Data
>     ActiveChart.SetSourceData Source:=Sheets("ALLDATA2").Range("N3:P14575"), 
> PlotBy:=xlColumns
>     'Display the first serie
>     ActiveChart.SeriesCollection.NewSeries
>     ActiveChart.SeriesCollection(1).XValues = TimeData
>     ActiveChart.SeriesCollection(1).Values = PVAC
>     ActiveChart.SeriesCollection(1).Name = "=ALLDATA2!R2C14"
>     'Display the second serie
>     ActiveChart.SeriesCollection(2).XValues = TimeData
>     ActiveChart.SeriesCollection(2).Values = SRDM
>     ActiveChart.SeriesCollection(2).Name = "=ALLDATA2!R2C15"
>    'Display the third serie
>     ActiveChart.SeriesCollection(3).XValues = TimeData
>     ActiveChart.SeriesCollection(3).Values = ISRM
>     ActiveChart.SeriesCollection(3).Name = "=ALLDATA2!R2C16"

-- 

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
0
andy9699 (3616)
9/25/2006 3:31:01 PM
Reply:

Similar Artilces:

How to select series in chart?
I know I asked this question before, but (sigh) I cannot find the answer now, when I need it of course. How can I select a series in an Excel chart (XY Scatter) using the keyboard, not the mouse? The issue is: I have overlapping series, so it is difficult for me to select a series by moving the mouse cursor to a point in one series and right-clicking it, as I normally do. Someone once mentioned a ctrl and/or shift key combination (I think) that would allow me to select each series explicit in round-robin fashion. That is what I am looking for again. More generally, how could I have found...

Problems with creating a newsletter
I chose the form "Newsletter - email". I have created a 3 page newsletter. Now, I have NO IDEA how to send it out as an email. I do not want to send it as an attachment. I cannot figure out which "save as" format or what I need to do so that i can email this newsletter. Is there a website that goes through how to do this? Am I correct when I say that it has to be html in order for me to send it as email? That is not one of the options. Any help you give me would be greatly appreciated. Thank you, Markis www.adreamforabetterworld.com ...

Meeting updates #2
My users cannot update meetings created when they were on the old email server. I have noticed that the old string is still mapped to the meeting. e.g x400;c=us;a= ;p=Org name;o=exchagne;s=Lastname;g=firstname; Take a look at the following article: 275134 XADM: Cannot Reply to Messages That Are Sent from a User Account That http://support.microsoft.com/?id=275134 The same thing applies to meetings. How did you move them and what version(s) of Exchange? Thanks, Richard Roddy Microsoft Exchange Support This posting is provided "AS IS" with no warranties, and confers no ri...

Changing SQL Server for CRM 1.2
As my SQL server is currently on its last breath I am in the process of moving our CRM 1.2 databases to a new dedicated serever. I have detatched the databases from the old server, copied the files to the server and attached them. I have then gone into CRM deployment manager and changed to the SQL server to the new server. That all appears to work fine, no error messages. But when users try to access the CRM system they get an error and the CRM server event log fills with error messages. A few are listed below: dmLog: Failed to execute the SQL batch in the file sqlbatch.sql. MSCRM P...

How do you turn off/on the "1" or "2" or "+" or "-" view hide/unh.
What is or how do you control, turn on/off the small "1" "2" or "+" "-" hide/unhide view buttons right above the "A" cell? Sometimes shows when I hide columns. Hi 'Data - Goup/Outline' -- Regards Frank Kabel Frankfurt, Germany Seth wrote: > What is or how do you control, turn on/off the small "1" "2" or "+" > "-" hide/unhide view buttons right above the "A" cell? Sometimes > shows when I hide columns. You can toggle them to hide or display with <Ctrl> <8> Usi...

visual basic
Hi, I trying to retrieve values from a table to calculate the 14days average value of a stock closing price. However, i encounter some problem as stated beside the code as follows: Function DaysAvgs() 'Calculate the average value of a given value. Dim db As DAO.Database Dim rst As DAO.Recordset Dim varBookmark As Variant Dim numAve, numDaysAvg As Double Dim intA, intB, lngCount As Integer Set db = CurrentDb 'Open Table Set rst = db.OpenRecordset("SGX Individual Historical", dbOpenTable) rst.MoveFirst Do While Not rst.EOF intA = 1 intB = 0 varBookmark = rst.Bookmark n...

Steps to Share Outlook on 2 different drives
This is a problem created by a dual boot of XPPSP2 on one drive C:\ and Vista on another drive E:\ that I use to format for new builds of Vista on the same box. I want to take my Outlook 2003 in box and folders on two different drives on one box and combine them so that all the emails go to one account and all the folders can be shared or used on each drive. I want to do the same with Outlook Express as well, and since this is an *Outlook newsgroup, I'll just take what I learn here and apply it to the ..dbx folder(s) in it. The idea is to receive email on both drives in one in one...

printing 2 charts on single page
Using Excel 2k, Win 2k I was trying to print to line charts on a single page to demonstrate the corelation between the two data sets. I would like to print in portait mode with one chart on top of page and one on bottom. Excel only seems to offer putting chart 2 on a separate page or embedding it in chart one. I am not very familiar with excel charting capabilites can anyone suggest a resorce? Thanks ...

.pdf save as settings
Hi, In Office 2007 Pro is there a way to change the settings such as preventing content copying etc. when saving a file to pdf? I have been trialling Open Office, alongside Office 2007 Pro (full version not a trial), which allows access to these settings but I can't see a way to do it in MS Office. -- Chas MS Office doesn't do that. Chass wrote: > Hi, In Office 2007 Pro is there a way to change the settings such as > preventing content copying etc. when saving a file to pdf? I have been > trialling Open Office, alongside Office 2007 Pro (full version not...

Web query timeout setting.
Dear Group, I fill an Excel table using data that I take from an Internet site. Unfortunately, this site is very slow and so I often get a "query did not provide any data" error message. How can I increment the default web query timeout limit? Thanks in advance, Enrico. ...

Offline folder problems #2
Hi Guys, Basically I installed Outlook 97 on my office PC which is connect to microsoft exchange server. For some reason all of my messages were copied into offline folders, this causes a problem, whenever I open up outlook I get this message. Upload of offline changes could not be completed you do not have sufficient permission to perform this operation on this object. See the folder contact or see your system administrator. I do not administrator access on my user profile, every time I open outlook it resets everything I have changed (view etc) and gives that error message. How ...

Unable to click customizing outlook today button
Unbable to click the customising outlook today button for Outlook 2000 install in the windows xp profession machine. I have updated the office 200 patch 3. But it seem remain the same problem. http://support.microsoft.com/default.aspx?scid=kb;en-us;820575 might be helpful. -- Neo [MVP Outlook] Due to the Swen virus, all e-mails sent to this account will be deleted w/out reading. "Clarence" <anonymous@discussions.microsoft.com> wrote in message news:06d101c3c939$78175620$a401280a@phx.gbl... > Unbable to click the customising outlook today button for > Outlook 200...

Setting up a new e-mail account
I'm trying to set up my yahoo account so that I receive my e-mail messages in my Outlook Inbox. I went to Accounts, and servers, and put in mail.yahoo.com for incoming mail (POP3) and smtp.yahoo.com for outgoing mail (smtp). When I click on the send/receive button I get an error message. Dave <anonymous@discussions.microsoft.com> wrote: > I'm trying to set up my yahoo account so that I receive > my e-mail messages in my Outlook Inbox. I went to > Accounts, and servers, and put in mail.yahoo.com for > incoming mail (POP3) and smtp.yahoo.com for outgoing mail &...

Unable to open Outlook Express after upgrade to Win. XP
I upgraded from windows98 to windows XP Pro. Now when I try to use OE I get two error messages. "Outlook Express could not be started. The application was unable to open the OE message store. Your compter may be out of memory or your disk is full.....0x800c012e,3" "OE could not be started because MSOE.DLL could not be initialized. OE maynot be installd correctly" I found a similiar problem fix for window2000 which said to delete OE, rename the old folder, then edit the registry and reinstall. I did the above but was not allowed to rename the old folder and th...

IsOutLookClient() returns wrong value
IsOutLookClient() returns wrong value when both web client of crm and outlook client are running on the same workstation It looks like the same cookie(used for determining what client is running) is used by the sessions of each client. Look for "LightClient" in IsOutlookWorkstationClient() in global.js Oeps...I seem to have made a wrong assumption... Between the to clients IsOutlookClient() seems to work ok... But in outlook client the IsOutlookClient() function gives false for me...after I have opened a page from the Microsoft Crm folder structure... On another workstation it...

Receiving Transaction Entry #2
I went into Receiving Transaction Entry to record the receipt of an item. The invoiced price did not agree with the purchase order. I had to add Shipping and adjust the provincial tax. I went to the proper screen to over-ride the calculated tax and the system told me that I couldn't do that because I had not filled in all the BOLD, RED areas. At that point I wanted to close down that screen, but the system would not let me do that either. I could minimize the screen and then I could also see that there wasn't any required information that had not be entered. The only way I c...

Opening pub files created with older Publisher versions #2
I have just upgraded to Publisher 2003 from 2000 and am having trouble with pub files sent to me for our chuch newsletter which is using Publisher 97 The text is not wrapping around graphics boxes. Can I fix this? I really don't want to go back to Pub 200 Thank Richard this is caused by Publisher 97 not been printer independent. Even if you went back to Publisher 2000, unless you have the identical font versions and printer driver you would have issues with formatting. It sounds like the person sending you the file has a garbage HP inkjet printer. Get them to install the HP5P laser p...

I would like to know how to set up a 'fill in the blanks' form?
I would like to set up a templet of sorts to fill in the blanks for certificates. ...

Associating Multiple Existing Contacts to an Account, Until CRM 2.x
I have racked my pea-sized brain for endless days for a way to associate multiple existing contacts (or accounts) to an account. My client has accounts that have many contacts (or accounts) involved at different stages of acquiring a new account. The logical method would be to add a custom attribute with lookup functionality into the existing CRM contact or account objects but this is not possible with CRM 1.x. The resulting UI would allow an end user to associate different contacts (or accounts) to an account. Example: Account: ABC - AccountPhysician: (existing account or con...

Unable to sort on customer CRM 4.0
Hi When you try to change the campaign response views to have customer as sorting CRM gives an error. You can't even click on customer column to sort when it's now customer that is default sorting. Is this a bug ? same here. I think its a bug "Help needed" wrote: > Hi > > When you try to change the campaign response views to have customer as > sorting CRM gives an error. You can't even click on customer column to sort > when it's now customer that is default sorting. > > Is this a bug ? > > > > ...

VCard issue #2
This is a weird problem, but when I send a vcard to someone, it shows up in my sent items as a vcf file, and has a vcard icon on it, but when the recipient gets the VCard, it shows up as msg file, with an envelope icon as the attachment. When I open it, nothing is there - it's empty. I can't find anything regarding this problem on google or MS's website. Anybody have any ideas? Is it a problem with Outlook? Do I need to do a detect and repair, a reinstallation? Thanks for your help! Does the same happen when you send a message to yourself? Is he/she able to see it w...

Some Excel formatting functions taking a long time to work #2
Excel 2000 SP3 When I use some formatting functions for the first time in a session, such as bold, increasing font size etc, it takes up to 30 seconds to work. Meantime Excel is locked up until it completes that formatting call. I suspect faulty DLL? Has anyone experienced this? How to fix (other than a complete re- install) ? Any advice appreciated. Piri On Nov 5, 8:39=A0am, Piri <wiremu.pare...@hotmail.com> wrote: > Excel 2000 SP3 > When I use some formatting functions for the first time in a > session, such as bold, increasing font size etc, it takes =A0up to 30 > secon...

changing values of one field based on another
How can I best change the values of one field in a table based on values of another field of the same table. We have an existing table of thousands of entries and I would like to use the following logic to populate a new boolean field. If field1 = "Done" Then BooleanFieldCompleted = True I have some Excel VBA experience but limited Access. I dont want to do this manually! Any assistance appreciated. In general, you'd use an Update query. However, in this case I don't see why you'd need such a field. Why not just create a query with a computed field that returns True...

MFC project with my classes
I have got a project that uses MFC. I want to expand the functionality of the project by adding a few of my own classes to it. But I don't know where should I create objects of my new classes so that I can access them, I know the WinMain function resides in CWinApp class and my project has a class inherited from the CWinApp class, but where should I define my own objects I can't figure it our. Can anybody help? Adrian wrote: > I have got a project that uses MFC. I want to expand the functionality > of the project by adding a few of my own classes to it. But I don't > kno...

Report to show Item Class Distribution Amounts
We would like to create a report, using Crystal Reports, that would show the following: dollar amount break down of the Sales Distribution accounts (COGS and Sales) per item class based on a date range. What is the most accurate way of going about this? We could only think of this method: (in short) sum the Ext Price based on SOP30300.CSLSINDX and SLSINDX and hope it matches the SOP10102 summed distribution amounts. Any advice would be appreciated. Thanks in advance. With the SLSINDX you would use the Extended Price and the CSLSINDX you would use Extended Cost. You would probably ...