+ Reply to Thread
Results 1 to 7 of 7

Graph Creation Problems

  1. #1
    Registered User
    Join Date
    11-26-2007
    Posts
    17

    Graph Creation Problems

    Hi,
    I was hoping someone with more experience than me could figure out why the highlighted code causes an error in the macro. This is only a snippet in the code but I think the only part that is important. Basically the procedure sets up an auto updating graph that accepts variables for : the worksheet it is embedded on, the worksheet the source data is on , the columns from which to use ranges from and the ActiveWorkbook.Names used. It is the ActiveWorkbook.Names that cause the problem. when I try to concatenate the name with the sheet name I get an error on the 'series' line of code (hilighted) if I omit the sheet name the error is fixed, but then all the graphs point to the same set of data. I need a way of automating the creation of a unique name. It seems that the best way would be to add the sheet name. If anyone can help me with this issue I would be really greatful. Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    You will probably need to post an example, but at a glance:

    Please Login or Register  to view this content.
    1. Where is GeneratedPageName initialized?

    2. SourceSheetName.name will have to be enclosed in single quotes if it contains spaces.

    3. In the Sub's declarations, the argument types should be declared.

  3. #3
    Registered User
    Join Date
    11-26-2007
    Posts
    17
    Thank you very much for the speedy reply

    1) GeneratedPageName is initialized at the top of the module (outside of any procedures) . I don't know if this is relevant but the its value is a number. Having said that, SourceSheetName.name is used multiple times in the code without causing any problems

    Please Login or Register  to view this content.
    2) it contains no spaces

    3) when you say they must be declared, do you mean within the Sub?

    again thanks for the help

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    The Sub declaration should look something like this:
    Please Login or Register  to view this content.
    Can you post an example that illustrates the problem?

  5. #5
    Registered User
    Join Date
    11-26-2007
    Posts
    17
    I am not sure what you mean. Do you want the xls file?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Yes, please.

  7. #7
    Registered User
    Join Date
    11-26-2007
    Posts
    17
    Sorry for the delay, and thanks for your previous help Shg. I tried my best to strip away any code that was unnecessary and unrelated. Then I realized you can't upload .xls files so I started stripping it down even further so i could send it as a word document that would work with the smallest input possible. In the process I stumbled on the problem. It was one of the variables. Thanks for the advice about declaring all variables etc. that definitely was part of the solution. But alas I am now stuck at a new hurdle though i feel it is much simpler.

    The Sub makeGraph now works properly

    Please Login or Register  to view this content.
    The sub is called w/ arguments sucha s this

    Please Login or Register  to view this content.
    the problem arises when i try to call it a second time right after the first, so as to add a new graph

    Please Login or Register  to view this content.
    I get :

    Run-time error "1004"
    that name is not valid

    refering to the activeworkbook line that worked the first time round. The name has only changed by one letter. i don't get it.

    Any insight as to wat is going on

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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