+ Reply to Thread
Results 1 to 11 of 11

formatting issue with data ranges in chart building macro

  1. #1
    Registered User
    Join Date
    07-04-2012
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    34

    formatting issue with data ranges in chart building macro

    Hi Everyone,

    In my excel sheet I have a dropdown list that referances different data ranges. I am trying to build a macro that takes a range name from this drop down box and builds a chart with the data. Then if the user wanted to use different data, they can select a new data range name and run the macro again below is my code, but I contiune to get errors:

    Any help would be great apprciated!

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    07-04-2012
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: formatting issue with data ranges in chart building macro

    Does anybody know the anwser to my question?

    I noticed this thread has a few views, perhaps I am phrasing my question wrong. Let me know.

    Thanks,
    Dane

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: formatting issue with data ranges in chart building macro

    It might help if you added a sample workbook, and if you have had quite a few views and no replies, maybe try explaining what you want, in a different way? (this will bump it to the top of the list again anyway)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    07-04-2012
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: formatting issue with data ranges in chart building macro

    Exceltrial.xlsx

    I agree, thanks for the idea FDibbins. Attached is a sample of what I am trying to accomplish. Does that give a better picture?
    The main road block I have come across is when I am building the vba code for the chart. How do I Indirect reference the text in a cell to a data range to be included in the chart?

    Thanks and I appreciate the help.
    You guys are rockstars!

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: formatting issue with data ranges in chart building macro

    Side tip: On this Forum I think "bumping" your own thread actually works against you. Our busy helpers soon discover the "UNANSWERED THREADS" link above in the menu bar, that link presents a list of the recent threads with zero replies. When you BUMP your own thread, you've added a reply which takes you OFF that list forever.

    So, probably shouldn't bump here, patience.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  6. #6
    Registered User
    Join Date
    07-04-2012
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: formatting issue with data ranges in chart building macro

    Thanks for the information JBeaucaire. I didn't realize this, as my only other experience is with a hockey forum, where bumping is the only way to get views. I will keep that in mind for the future.

  7. #7
    Registered User
    Join Date
    07-04-2012
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: formatting issue with data ranges in chart building macro

    Here is an update on how far I have made it new code:

    My issue still stems from the "ActiveChart.SeriesCollection(1).Values = "=Sheet2!.Range(mytext)" I believe I am referencing this wrong

    Please Login or Register  to view this content.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: formatting issue with data ranges in chart building macro

    Perhaps:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-04-2012
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: formatting issue with data ranges in chart building macro

    @JBeaucaire I appreciate the help but that didn’t seem to work either. I am no trying a case possibility, what do you think now?

    Please Login or Register  to view this content.

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: formatting issue with data ranges in chart building macro

    If that were going to work, it would be like this, which is really no different than my earlier suggestion:

    Please Login or Register  to view this content.
    That's the same as:
    Please Login or Register  to view this content.


    In YOUR code, you set MyText = C5, but then you immediately change it something called Loops.


    Maybe cut to the chase and just use:

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 06-25-2013 at 08:39 PM.

  11. #11
    Registered User
    Join Date
    07-04-2012
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: formatting issue with data ranges in chart building macro

    Yes, that did JBeaucaire. I believe I had that in from some old code I was playing with it works now.

    Thanks for the help everyone!

+ 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