+ Reply to Thread
Results 1 to 12 of 12

Select Method of Range Class Failed

  1. #1
    Registered User
    Join Date
    09-15-2015
    Location
    BC, Canada
    MS-Off Ver
    2013
    Posts
    7

    Exclamation Select Method of Range Class Failed

    Hi,

    I'm trying to write a code such that when the user presses the button GRAPH, it graphs the data in the file for each column
    Capture.PNG

    I run into a debug error on this line:
    Please Login or Register  to view this content.
    Full code:
    Please Login or Register  to view this content.
    It's weird because I wrote this code before and it worked before. Now I'm trying to modify it responds through a button on a form so that it is more user friendly.
    This is my old code that worked. I can't seem to see the difference.

    Please Login or Register  to view this content.
    DataProcessing_Tool.xlsm
    Last edited by lalaluye; 09-15-2015 at 04:31 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: Select Method of Range Class Failed

    Do you need to select the range?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    09-15-2015
    Location
    BC, Canada
    MS-Off Ver
    2013
    Posts
    7

    Re: Select Method of Range Class Failed

    I need to select a range to graph it right? When I edit the range out, it gives me an empty graph.

  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: Select Method of Range Class Failed

    You specify the same range as the source for the chart a couple of lines down, here.
    Please Login or Register  to view this content.
    I would have thought that was all you would need.

  5. #5
    Registered User
    Join Date
    09-15-2015
    Location
    BC, Canada
    MS-Off Ver
    2013
    Posts
    7

    Re: Select Method of Range Class Failed

    I tried removing that range select line, but it gave me an empty chart.

  6. #6
    Registered User
    Join Date
    09-15-2015
    Location
    BC, Canada
    MS-Off Ver
    2013
    Posts
    7

    Re: Select Method of Range Class Failed

    You are right. We don't need to select the range.. I removed it from my old code and it still graphs.
    However, I am still not getting any graphs for my modified code to fit the userform. I get a debug error at strChrt = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, "")) indicating "The item with the specified name not found"

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

    Re: Select Method of Range Class Failed

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  8. #8
    Registered User
    Join Date
    09-15-2015
    Location
    BC, Canada
    MS-Off Ver
    2013
    Posts
    7

    Re: Select Method of Range Class Failed

    Sure! I attached it to the first post. It is still work in progress. Here is the sample data I need to graph (individually by column)DC Merged.xlsx

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

    Re: Select Method of Range Class Failed

    I think I know what the problem is.

    When you refer to a range in a worksheet module without specifying explicity the sheet and workbook the range is from VBA uses the range on the worksheet who's module the code is in.

    In this case the code is looking at Sheet1 in DataProcessing_Tool.xlsm, not the active sheet of DC Merged.xls.

    Give this a try.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    09-15-2015
    Location
    BC, Canada
    MS-Off Ver
    2013
    Posts
    7

    Re: Select Method of Range Class Failed

    I get a debug error here: .Shapes(strChrt).Left = nLesft
    The item with specified name wasn't found.

    I do see a graph now. Thank you very much. The next part (trying to place it in specified location) is a bit bugged.
    Last edited by lalaluye; 09-15-2015 at 05:03 PM.

  11. #11
    Registered User
    Join Date
    09-15-2015
    Location
    BC, Canada
    MS-Off Ver
    2013
    Posts
    7

    Re: Select Method of Range Class Failed

    It worked, then it doesn't work again when I pressed the GRAPH button... :S

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

    Re: Select Method of Range Class Failed

    You mean when you run it manually it works but it doesn't work when you click the GRAPH button?

    Strange, it works both ways for me with the sample file.

+ 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. [SOLVED] Select method of range class failed
    By cjgraham92 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-19-2015, 07:49 PM
  2. Select method of range class failed
    By JayWeb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2010, 09:41 PM
  3. Select Method of Range Class Failed
    By Screamtruth in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-07-2010, 07:01 AM
  4. Select method class range failed
    By phillb in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-05-2007, 06:45 AM
  5. Select Method of range class failed
    By excel_rookie74 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2006, 12:17 PM
  6. Select method of range class failed
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2005, 09:05 AM
  7. What did I do? (Select Method of Range Class Failed )
    By HotRod in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-20-2005, 10:06 AM

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