+ Reply to Thread
Results 1 to 10 of 10

Edit chart seriescollection within a "With" - "End With" Block

  1. #1
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Edit chart seriescollection within a "With" - "End With" Block

    Hello.
    In Excel Worksheet I need to edit a Chart (seriescollection values and format.fill
    I got a code with the macro recorder on. For me such codes are confusing.
    I need to modify the following codes to look for efficiency.

    Here my codes:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    How can I write these codes lines within a "With" "End With Code?
    Also, how can I write
    Please Login or Register  to view this content.
    As VBA:
    Please Login or Register  to view this content.
    If this is correct.

    I hope some else can help me.
    Cheers

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Edit chart seriescollection within a "With" - "End With" Block

    Not tested...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Edit chart seriescollection within a "With" - "End With" Block

    I really appreciate your reply.

    I wrote the first code as:
    Please Login or Register  to view this content.
    VBA displays 'Error 438 Object does not support this property or method' here:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    VBA displays 'Error 438 Object does not support this property or method' here:
    Please Login or Register  to view this content.
    I am trying to write codes inside a With End With Block.
    Moreover, I tried to declare variables such as.
    Please Login or Register  to view this content.
    I spent hour and hours googling and I did not find similar code examples.

    Any help is really welcome

    Cheers

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Edit chart seriescollection within a "With" - "End With" Block

    Did you try the code I posted without change? If yes, did it work?

    Why are you changing the editformarfill code I suggested?

  5. #5
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Edit chart seriescollection within a "With" - "End With" Block

    Hello.
    Yes, I tested your code. Works well.
    I really apologize. First, I just to write my messages in NotePad. I think my previous post was a problem of copy and paste.

    Only the second code displays "Runtime Error 91: Object variable or with block variable not set"
    Please Login or Register  to view this content.
    I have been trying to fix it, but error still ocurred.

    Cheers

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Edit chart seriescollection within a "With" - "End With" Block

    Did you first select the chart before running the editformarfill macro?

  7. #7
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Edit chart seriescollection within a "With" - "End With" Block

    Hello. Thanks

    To test both codes I used F8.
    First I ran the first code that works perfectly.
    Then, I ran the second code and "Runtime Error 91: Object variable or with block variable not set"

    Cheers

  8. #8
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Edit chart seriescollection within a "With" - "End With" Block

    AlphaFrog

    I did a few changes to your codes and now all three are working well:

    First code:
    Please Login or Register  to view this content.
    Second code
    Please Login or Register  to view this content.
    Third code
    Please Login or Register  to view this content.
    Can you tell if there is a way to simplify the three codes into one code?
    Is possible to simplify the codes using variables? If true, How can I add variables?
    Is it true that from 2010 "fullseriescolletion" should be written as "seriecolletion"?

    I really appreciate your help

    Cheers

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Edit chart seriescollection within a "With" - "End With" Block

    Don't need variables in his case.

    FullSeriescollection was introduced in 2013. It's is slightly different (having to do with filtered data) than the usual .SeriesCollection but probably is irrelevant in this case. Use Seriescollection for backward compatibility.

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    04-22-2014
    Location
    Turrialba, Costa Rica
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Edit chart seriescollection within a "With" - "End With" Block

    AplphaFrog.
    Your codes work fine.
    I still don't know the use of Exclamation Mark (!) in the code.
    Thank you for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  2. Replies: 2
    Last Post: 07-24-2017, 02:19 AM
  3. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  4. Chart SeriesCollection(i).XValues "error 1004: invalid parameter"
    By aochan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2016, 04:16 AM
  5. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  6. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  7. Error msgs: "Object varible or with block variable not set"; "subscript out of range"
    By menyanthe in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-26-2009, 04:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1