+ Reply to Thread
Results 1 to 4 of 4

Beginner needs help! "Run-time error 438" while attempting to format multiple series

  1. #1
    Registered User
    Join Date
    09-14-2016
    Location
    Uppsala, Sweden
    MS-Off Ver
    2010
    Posts
    3

    Beginner needs help! "Run-time error 438" while attempting to format multiple series

    Hello,

    I have several charts with multiple series in one worksheet and I want to format line thickness, marker size and marker type for all the series of all these charts.
    This is my first time with VBA coding and here is the code I wrote to try to do that:

    Sub LoopThroughCharts()

    Dim cht As ChartObject
    Dim ser As Series

    For Each cht In ActiveSheet.ChartObjects
    For Each ser In cht.SeriesCollection
    ser.Format.Line.Weight = 0.5
    ser.MarkerSize = 5
    ser.MarkerStyle = xlMarkerStyleCircle

    Next ser
    Next cht

    End Sub

    But I have a "Run-Time error '438': Object doesn't support this property of method" when I reach the "ser.Format.Line.Weight=0.5" line.
    I have double-checked and all the properties I used for ser, a Series object, are Series properties so I just don't understand why this code doesn't work.

    What's wrong with my code?
    Thanks for any help!

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Beginner needs help! "Run-time error 438" while attempting to format multiple series

    Hi,

    I don't believe the code should get that far because a ChartObject is the container for a Chart. The ChartObject itself does not have a SeriesCollection. Thus the previous line should in fact read

    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    09-14-2016
    Location
    Uppsala, Sweden
    MS-Off Ver
    2010
    Posts
    3

    Thumbs up Re: Beginner needs help! "Run-time error 438" while attempting to format multiple series

    Great, thanks, that solved the problem!

    Elodie

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Beginner needs help! "Run-time error 438" while attempting to format multiple series

    You're welcome.

+ 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: 1
    Last Post: 08-05-2014, 05:03 AM
  2. Script not copying data from "Emails" sheet to "New Sheet" - Run time error: Object
    By methuselah90 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-08-2014, 03:22 PM
  3. Excel 2010 (Run-time error '13' type mismatch) "Debug" and "Continue" Grayed out.
    By Jeronimo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2012, 06:42 PM
  4. Replies: 2
    Last Post: 11-01-2012, 04:35 PM
  5. [SOLVED] "Run-time error '13': Type mismatch" when deleteing multiple cells from targeted columns
    By mweickdival in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2012, 01:09 PM
  6. Run-time error "1004" when changing the name of a series
    By Doctorul in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 04-26-2010, 04:15 AM
  7. Extract "Time" from custom "Date and Time" format
    By ben_patto in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-24-2009, 08:47 PM

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