+ Reply to Thread
Results 1 to 3 of 3

Graphing data from Sheet2 & placing graph on Sheet1 error

  1. #1
    Registered User
    Join Date
    11-17-2017
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    60

    Graphing data from Sheet2 & placing graph on Sheet1 error

    Hi All,

    I am trying to plot a graph.
    I have one workbook with two worksheets, they are Sheet1 and Sheet2.

    There are lots of rows of data in both Sheets, I am plotting graphs from the data in Sheet1 and placing them on sheet1 near the data that I am using. Then for one of the graphs I am accessing data from Sheet2, but placing this graph on Sheet1 to keep all of the graphs together for display. Here’s where I have the problem, when I was testing the code on a certain Workbook, it all worked fine, but when I opened up another Workbook, with only two worksheets – Sheet1 and Sheet2, it appears to be exactly the same as my tests Workbook it come up with the “Run-time error 9” – Subscript out of range.

    And stops at this line

    Please Login or Register  to view this content.
    Here is the is cut down code

    Please Login or Register  to view this content.
    Hopefully someone can see what I cannot or offer some advice.

    Thanks
    Nat

  2. #2
    Registered User
    Join Date
    05-30-2016
    Location
    CZ
    MS-Off Ver
    O365
    Posts
    13

    Re: Graphing data from Sheet2 & placing graph on Sheet1 error

    Hi, you have probably checked the exact names of the sheets in the new workbook so, have you tried to activate the workbook on the start of the code? Or try defining a workbook variable to be used for the current workbook and use it instead of the "ThisWorkbook" parameter?

  3. #3
    Registered User
    Join Date
    11-17-2017
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    60

    Re: Graphing data from Sheet2 & placing graph on Sheet1 error

    Thanks harprik, I tried this and still the problem exists.

    Just to clarify more the code I am using is in an xla file that opens up every time I open excel. I open the excel file with my data in Sheet1 and Sheet2, Sheet1 is the active sheet and when I run the code it always has an error accessing Sheet2. Could it be related to this?

    Thanks
    Nat

+ 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] A macro which pulls the data from sheet2 to sheet1 basis of scenarios selected in sheet1
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-15-2015, 01:46 PM
  2. [SOLVED] copy data from sheet1 to sheet2 based on column (A) sheet1 and column (C) sheet2
    By AWITCHER in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-13-2014, 03:20 PM
  3. Replies: 6
    Last Post: 07-25-2013, 02:58 PM
  4. Copying data returning an error in Sheet1 to next empty cell in specific column of Sheet2
    By cloudwalking in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 03-22-2013, 09:02 AM
  5. [SOLVED] Take Data From Column on Sheet1 and Insert Into Next Blank Row on Sheet2 Then Clear Sheet1
    By abutler911 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2013, 06:30 PM
  6. [SOLVED] Data in sheet1, graph in sheet2
    By hammer2 in forum Excel General
    Replies: 2
    Last Post: 08-07-2012, 02:10 AM
  7. Replies: 3
    Last Post: 06-06-2012, 05:36 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