+ Reply to Thread
Results 1 to 5 of 5

compile error after editing VBA so graphs are independent of the worksheet

  1. #1
    Registered User
    Join Date
    06-03-2009
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    35

    compile error after editing VBA so graphs are independent of the worksheet

    I am doing some research and I created a lot of worksheets with the same data-format. From every sheet I want to create the same type of graph, so a macro could be very useful.

    First I recorded a macro. The worked fine, but it could only be used by only one worksheet. Every time I used the macro it returned to the original worksheet where I created the macro.

    With some searching I found out how to change the code so that the macro could be used for the active sheet.

    But now I get stuck with the following error: "compile error: invalid qualification" (translated from Dutch).
    With error tracking I get stuck at the first line "Sub grafiek()"


    I tried to solve this error, but I don't understand the problem. Can someone help me solving?

    ---------------------------

    This is my code:
    Please Login or Register  to view this content.
    Last edited by kjiratsiekoedel; 06-03-2009 at 09:47 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,292

    Re: compile error after editing VBA so graphs are independent of the worksheet

    You would need to replace all instances of sSheetName.Name with just sSheetName since it is a String not an object. (there may be other errors, but that one jumped out at me!)
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    06-03-2009
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: compile error after editing VBA so graphs are independent of the worksheet

    That helped!

    Now there is a second error: I want that the graph is inserted in the active sheet. The error in bold

    Please Login or Register  to view this content.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,292

    Re: compile error after editing VBA so graphs are independent of the worksheet

    You would need:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-03-2009
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: compile error after editing VBA so graphs are independent of the worksheet

    Thanks. I know I had a newbe question, but I am very happy you could help me so quickly!

+ 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