error in legendentry


I have a chart that needs more legend entries than can be visible shown 
in the chart.

When I try to access (= change color with Interior.Colorindex) the 
legend entry, an error occurs (Unable to get the LegendKey property of 
the LegendEntry class). Is this due to fact that the LegendEntry in 
question is not "visible"?

If I decrease the number of LegendEntries, my macro will execute perfectly.

Here's my code:

Sub ColorMacro()
     Dim minVoltage As Double
     Dim maxVoltage As Double
     Dim i As Integer

     Charts("Voltage chart").Activate

     minVoltage = ActiveChart.Axes(xlValue).MinimumScale
     maxVoltage = ActiveChart.Axes(xlValue).MaximumScale

     'changes the scale of the legend
     With ActiveChart.Axes(xlValue)
         .MinimumScale = 0
         If maxVoltage <= 15 Then
             .MaximumScale = 15
             .MaximumScale = maxVoltage
         End If
         .MajorUnit = 0.5
     End With

     'loop through legend entries
     For i = 1 To ActiveChart.Legend.LegendEntries.Count
         If i = 1 Then
             With Selection.Interior
                 .ColorIndex = 4
             End With
         End If
         If i >= 2 And i <= 9 Then
             With Selection.Interior
                 .ColorIndex = 6
             End With
         End If
         If i >= 10 And i <= 20 Then
             With Selection.Interior
                 .ColorIndex = 45
             End With
         End If
         If i > 20 Then
             With Selection.Interior
                 .ColorIndex = 3
             End With
         End If
End Sub

Note that my code is not finished yet. What I'm trying to do is to 
change the legend maximum and minimum values (to 0 and 15, or if voltage 
is higher, then that value) and change the colours so that the first 
legendkey (0-0.5) has one colour, a couple of next legendkeys has 
another and so on.

I would also like to delete some of the legend entries so that only one 
is shown per colour. And moreover, if possible, I would like to change 
the texts of the legend entries manually through VBA, but I guess that 
is not possible.

I would appreciate any help!

Thanks in advance,
c_at_man (4)
12/14/2005 8:23:52 PM
excel 39879 articles. 2 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 58


Similar Artilces:

Error 20488 on only one client
When posting PO we are receiving the following error: The stored procedure glpBatchCleanup returned the following results: DBMS: 0, Great Plains: 20488 I found KB 896545 in the Knowledge Base of Customer Source but in reading the KB I would have to believe that all clients would be having the same problem because the KB states that the problem occurs if the SY00500 Posting Definitions Master table is damaged. Does anyone have an idea as to what would cause this problem on one client and how to fix it? Thanks in advance. JTT Hello JTT, I have seen this specific error on 8.0 after a ...

Outlook and McAfee Error
I am getting a strange error when I open up Microsoft Outlook that referrs to McAfee. Anyone else have this problem or know how to fix it. I tried debugging it with no luck. I have unistalled and reinstalled McAfee. This is what the error is saying. The add in "c:\progra~1\\vso\vsolplg.dll" could not be installed or loaded. This program may be resolved by using Dectect and Repair on the help menu. I have tried the Dectect and Repair within Outlook 2003 - no joy. I am new to using Outlook so I am not sure if I am missing something there but find suspect it is s...

error connecting to the server while send/receeive in progress
My AOL account was correctly added to Outlook, however I am trying to subscribe to other folders in my email and I am reveiving an error (0x800CCC0E) connecting to the server. How do I correct this? ...

"A Runtime Error has occurred"
Whenever I go to the Quote screen after clicking on the chart in Portfolio, I get the following error message: A Runtime Error has occurred. Do you wish to Debug? Line: 74 Error: Object expected I assume this has something to do with integrated IE. Anyone know what's wrong and how to fix it? ...

HI, My application is mulithreaded VC++ console based application. Some times when i run the application, pop up error is displayed as "User break point called from code at 0xxxxxxx". But, there are no Break points set in the code. Please help ! Gary "Gary" <> wrote in message news:%23vXcZekhDHA.3784@tk2msftngp13.phx.gbl... > HI, > My application is mulithreaded VC++ console based application. Some times > when i run the application, pop up error is displayed as > "User break point called from code at 0xxxxxxx". But, the...

Error MSG when going offline
I have a couple users that when they try to go offline they get an error saying SQL server timed out. The only KB I find relevent is 913802 which the Rollup Patch fixed. Any Ideas? Thanks. ...

Word error message
Every time I try to close Word, i receive a message that says word has stopped working. Larry wrote: > Every time I try to close Word, i receive a message that says word has > stopped working. Are you trying to close Word from a .NET application (for which this newsgroup is appropriate), or did you intend to post to a newsgroup/forum which deals with Word? If the latter, I suggest you also tell them which operating system you are using and which version of Word. (Or just google it.) -- Andrew "Larry" <> wrote ...

Error Message on my Report
I have put hours and hours into my application, and all seemed to being going well. Suddenly, one of my reports won't run any more and instead gives me the error message " There isn't enough free memory to update the display. Close any unneeded programs and try again". I get this message even if Access is the only program running and the report is the only thing open. The underlying query is working fine. I have tried removing individual controls and even eliminated all controls from the report but the error message continued. I have tried the compact and repair ...

is there a way to turn off the display of an error message
i have a workbook setup that have several pages in it (for a month) and some math where a cell that may not be filled in yet is a 0 value. so i am getting lots of divide by zero errors. it certainly is useful to know but detracts from the appearance. can this selectively be turned off? thanks. jim Hi Jim! There's different ways of approaching this. Try amending the formulas that resolve to the error: Example =IF(B1=0,"",A1/B1) This returns an empty looking cell until a numeric entry is made to B1. But note that it will return #VALUE! if text is input to B1. This is ...

Cash Receipt Error
Hi, I am using Dynamics GP 10.0 and I had a problem two days ago. we wanted to enter a transaction in the cash receipt entry, but an error message states that the document number has been used. i checked the smarlist if we have ever used the documnet number, but we have didnt. I used the serial of the payment documents from GP and it gave the same error. I checked the setup files and all the configuration were fine. can anyone help me with this problem Best Regards Haitham H. Sanber Hi, Run checklins (MSDGP>>Maintenance>>Checklinks) on Sales Series to remov...

hiding formula error #DIV/0!
Hithere, In a sheet, for a cell I use the formula: =(F4/1,19-D4)/(F4/1,19) If there is no input yet in cells F4 or D4 an error message "#DIV/0!" is shown. I don't want this message visable when there is no input yet in F4 and D4. The solution I found Googling was to use =IF(ISERROR(OriginalFormula),"",OriginalFormula) Translating that to my formula, I came up with: =IF(ISERROR((F4/1,19-D4)/(F4/1,19)),"",(F4/1,19-D4)/(F4/1,19)) Inserting this formula however makes Excel complaining that there is an error in this formula, specificly pointing to the ,&quo...

Outlook error 0x800cc19
Hi My boss came to me today saying he couldnt send or receive email on his outlook account. When I tried to send from the account i got the following error: 'A timeout occured while communicating with server. Account, SMTP server: '', Error Number: 0x800cc19' I did some investigatory work and installed the service pack for internet explorer 6 as others have said this fixed the problem. I also tried disabling the virus software from scanning outgoing messages but this didnt help either. The computer is running XP. Can anyone help...

Cannot delete e-mail
When I try to delete an e-mail message I receive an error message 'outlook.pst could not be accessed' I don't know the solution to this issue. >-----Original Message----- >When I try to delete an e-mail message I receive an error >message 'outlook.pst could not be accessed' > >I don't know the solution to this issue. > >. >Try pressing the shift key and delete key simultaneous, this should permanently delete the msg. Mark ...

DHCP Limited Connectivity error
Hi At one of my clients I have connected 2 new PC's to a SBS 2003 R2 network using the ConnectComputer wizard. For several days they have worked perfectly. Now, within an hour or so of each other, they have both lost their DHCP assigned IP addresses and will not reconnect to the network. I have checked the server and these machines are correctly registered with DHCP, WINS and DNS. There are no events relating to these problems in the Event Logs. When I reconnect the old machines using the same cabling, they receive DHCP assigned IP addresses and connect immediately. ...

Fix found for 0x80004005 error
As it turns out the tzmove.exe is an installation file that creates a tzmove.exe file in the Office folder which is only 300K not 8MB and which also works. I changed the MSExTmz_x.ini to look at this new file and all errors went away. I struggled for hours with that one and I ended up ignoring it. The error said something about unable to get time zone. I checked calendars that were 1 hour ahead and they were normal after the patch. On Mar 10, 10:14 pm, Roger Wogan <> wrote: > As it turns out the tzmove.exe is an installation file that creates a...

Microsoft Outlook 2000 error
Every time I send an e-mail or reply to an e-mail I get an error box from Outlook that states that this program has performed an illegal operation and will be shut down. The detail message always says module < unknown > . The e-mail however always goes and I also receive with no problem. The only thing is that I have to restart outlook every time. Please offer some help if you can. ...

Error when trying to create ACCDE
When I try to create a ACCDE from a Access 2007 database I get a error message. The error message is (translated from swedish version): "You con not add or edit the record. It requires a related record in the table MSysAccessStorage" This happens on all databases I have tried. Is there some general setting that I nedd to alter? -- Kjell Harnesk, Sweden. Hi Kjell, Can you provide us with some more details about your issue? 1. What OS are you using? What language installed for the OS? 2. What language is your Office/Access installation? 3. Do you have other versions of Access ...

First time open Outlook get communication error yet website CRM wo
Every morning when I open Outlook, I get a "problem communicating with CRM" error. I try with IE and it works fine, so there is no problem with CRM. If I close Outlook, then open it again, it's fine. Why is it always failing the first time? ...

Error while archiving store "Personal Folders" Outlook 2002
Help! I've been unable to archive for a long time. My outlook.pst is over 400MB. I'd like to trim it but be able to access the old stuff. Is there a diagnostic? Cure? Thanks, - Dave McKeen Dave McKeen <> wrote: > Help! I've been unable to archive for a long time. What happens when you try? My outlook.pst > is over 400MB. That's not large. Your PST can grow to three to four times that size. > I'd like to trim it but be able to access the old > stuff. So, create a new PST and move to it the items you want to save. Com...

Export-Mailbox: MAPI or an unspecified service provider. ID no: 00000000-0000-00000000, error code: -1056749164
I have installed a 32 bit 2008 standard sp2 server, outlook 2007, some iis components and the exchange 2007 sp1 32bit management tools. (the actual exchange server is running 2007 sp2) I have ensured that the user (administrator) has full access rights over the maibox in question, however I can't get "Export-Mailbox" to run What else do I need to check, see below txt version of log file: [17/03/2010 11:55:27] [0] Executing Command: 'Export-Mailbox -Identity administrator -PSTFolderPath c:\pst\201002\administrator.pst' [17/03/2010 11:55:28] [0] Trying to op...

Error with "Delivery Status Notification (Delay)"
Hello fellow canines, After sending email from inside CRM 3 I get the following message in Outlook 2003 from Administrator; This is an automatically generated Delivery Status Notification. THIS IS A WARNING MESSAGE ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. Delivery to the following recipients has been delayed. The email never reaches the intended recipient, as I get an error message later in Outlook from System Administrator. The email gets stuck in the “SmallBusiness SMPT Connector Queue in SBS 2003 and blocks all other emails The strange thing is tha...

Error in :"Transfers out of Budget Accounts"
I know this is a popular theme here in this newsgroup but i'll throw it out there anyways... My issue is in the budget. I was able to get it to count all of my transfers under a special "Transfers to Know for Budget" category. I have placed all my savings goals and etc here that were not being captured by the "Transfers out of budget accounts" line item in my budget. The actual probelm is that when I view the annual/monthly budget in reports view it counts my stock/mutual fund purchases under this "transfers out of budget accounts" category. Does anyo...

PST Backup: Error Copying file
Each time I try to backup Outlook 2000 files I get this message: "Cannot copy mailbox: The process cannot access the file because another process has locked a portion of the file." Anybody have a clue how I can fix this problem Not until you tell us how you are trying to back up the file. You must make sure Outlook is closed completely before you try. -- Russ Valentine [MVP-Outlook] "Marty" <> wrote in message news:_ss4g.17$Mn6.12@trndny06... > Each time I try to backup Outlook 2000 files I get this message: > > "Cannot copy mail...

error accessing file
i keep getting this error; never had it before. I reinstalled SP3; am using SQL backend for the tables. Over the weekend, SQL went down. since then, I've not been able to go the event procedures, code, etc. whenever i try deleting/changing code i get the error accessing file, connection may have been lost. Any suggestions? On Wed, 2 Jan 2008 12:34:30 -0800, Miskacee <> wrote: >i keep getting this error; never had it before. I reinstalled SP3; am using >SQL backend for the tables. Over the weekend, SQL went down. since then, >I've not bee...

recurring meeting error message
Hi, I am not sure where to place this question so its in two locations. I am trying to setup a recurring meeting in outlook 2000, I setup the attendee's and location at one of our meeting rooms. On pressing send I get the following message - "" New Board room" has declined you meeting because it is recurring. You must book each meeting separately with this resource". Recently changed mailbox from automatically accepting\declining meetings and gave secreatary manual ability to do this on her request. I have checked on boardroom mailbox on exchange server that h...