+ Reply to Thread
Results 1 to 12 of 12

run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

  1. #1
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    I had this particular code and it gives me an error.

    Please Login or Register  to view this content.
    As you can see, I have an if statement at the top to check if mySrs.Formula has the string that I want to substitute, and if not, then end if.

    However, it seems that even though the InStr is giving the result of 0, it still kicks in to 'mySrs.Formula' line.

    May I know what's wrong with it?
    Last edited by dluhut; 10-12-2016 at 01:49 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    If InStr does return 0 the mySrs.Formula will definitely not be executed.

    Have you checked what WorksheetFunction.Substitute(mySrs.Formula, OldString, NewString) is actually returning when you get the error?

    PS VBA has it's own equivalent of WorksheetFunction.Substitute - Replace.
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    Hi Norie,

    That's what I thought too...if InStr does return 0, then mySrs.Formula will not be executed. However it DOES!!! Which is why I'm confused.

    From what I can tell, the mySrs.Formula = WorksheetFunction.Substitute(mySrs.Formula, OldString, NewString) is giving the error because mySrs.Formula does not have the 'Old String' that I want to replace. That's why it's giving me the error.

    That's the reason why I have the IF statement to check if mySrs.Formula has 'Old String'.

    No matter how I run the macro multiple times, it's giving me the same error line.

    I tried to use 'On error go to next', but some how, all the charts that were copied over (via copy and paste to new destination workbook) were all gone.


    Quote Originally Posted by Norie View Post
    If InStr does return 0 the mySrs.Formula will definitely not be executed.

    Have you checked what WorksheetFunction.Substitute(mySrs.Formula, OldString, NewString) is actually returning when you get the error?

    PS VBA has it's own equivalent of WorksheetFunction.Substitute - Replace.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.

  5. #5
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    I'd definitely would upload samples if I could. But I really can't.

    Because it's 2 files...and these 2 files, they have several sheets (identical sheet name in each) that I need to copy from and to.

    But before I copy over, I need to delete first.

    So basically, what I did is that when I run the macro:
    1. Macro will pop up a user form box to ask user which is the SOURCE WORKBOOK that I want to copy the sheets from.
    2. Macro will pop up a user form box to ask user which is the DESTINATION WORKBOOK that I want to paste the sheets to.
    3. Macro then delete all those sheets from the destination workbook.
    4. Macro then copy each desired sheets from the source to the destination.
    5. Macro then change all cells and charts that has formula of the source workbook name (OldString) to the current destination workbook (NewString)

    Quote Originally Posted by Norie View Post
    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    Have you checked what WorksheetFunction.Substitute(mySrs.Formula, OldString, NewString) is returning when you get the error?

    To do that just click Debug when you get the error, open the Immediate Window with CTRL+G and enter this in it.
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    Please Login or Register  to view this content.
    is returning

    Please Login or Register  to view this content.
    Also I've attached a picture on my 1st thread to show the values of the Instr etc.

    Quote Originally Posted by Norie View Post
    Have you checked what WorksheetFunction.Substitute(mySrs.Formula, OldString, NewString) is returning when you get the error?

    To do that just click Debug when you get the error, open the Immediate Window with CTRL+G and enter this in it.
    Please Login or Register  to view this content.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    Is that formula right?

    What happens if you change the code to this?
    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    It's still giving the same error.

    It still goes into the mySrs.Formula (below the IF statement) even though the Instr is giving 0 as the answer.

    Quote Originally Posted by Norie View Post
    Is that formula right?

    What happens if you change the code to this?
    Please Login or Register  to view this content.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    There must be something wrong with the formula/series or something else.

    What, in words, is the code meant to do anyway?

  11. #11
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    Hi Norie,

    Problem solved. I moved from

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    And it works. So I guess all is good.

    Reps up to you for helping me out here.

  12. #12
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: run time error -2147417848 (80010108) Method 'Formula' on object 'Series' failed

    What I was trying to do is to loop through all sheets, and for each sheet that has a chart, look at the formula (which is the mySrs.Formula), and if the formula string has the 'Old String', replace it with the 'New String'

    Quote Originally Posted by Norie View Post
    What, in words, is the code meant to do anyway?

+ 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. Run-time error '-2147417848 (80010108)' Method 'Formula' of object 'Range failed
    By JessKong1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2016, 02:02 AM
  2. [SOLVED] RunTime Error 2147417848 -Method insert of object Range Failed
    By Vassen in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-14-2016, 06:58 AM
  3. Run-time error -2147417848 (80010108) Method Value of object Range failed
    By Arito in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2015, 02:10 PM
  4. Runtime Error 2147417848(80010108) Method Autofill of Object Range failed
    By seejohn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-10-2014, 08:03 AM
  5. Replies: 7
    Last Post: 05-15-2013, 09:02 AM
  6. "Runtime error '-2147417848 (80010108)' Method 'find' of object 'Range' failed"
    By excelworker_1 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-14-2012, 09:53 AM
  7. Replies: 7
    Last Post: 08-24-2005, 11:05 AM

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