+ Reply to Thread
Results 1 to 8 of 8

Creating a series of named ranges though VBA in a fast way

  1. #1
    Registered User
    Join Date
    11-13-2013
    Location
    Rome
    MS-Off Ver
    Excel 2007
    Posts
    14

    Creating a series of named ranges though VBA in a fast way

    Dear Excel users,
    I've recently learnt how to create charts that dynamically update to new sets of updated data, and I've found it pretty amazing.
    The method I have used is through giving specific names to ranges and then using the OFFSET and COUNTA functions to make them match...however there is a problem with this method.
    I am making graphs for a wide range of time series data and while the values on the X axis are the same for all the charts, of course the Y values vary for each chart and that means that I have to manually name all these ranges with different names and that takes a lot of time.

    My Question is is there a way to do all this process of naming all the different ranges through a VBA code?
    I am really new at VBA coding so please excuse me if this is a really stupid question :D Looking forward to your reply, thanks!

  2. #2
    Forum Contributor lancer102rus's Avatar
    Join Date
    04-02-2014
    Location
    Ufa
    MS-Off Ver
    Excel 2010, 2013
    Posts
    252

    Re: Creating a series of named ranges though VBA in a fast way

    With VBA you can do almost everything. But without an example (your Excel file) it is hard to help you.

  3. #3
    Registered User
    Join Date
    11-13-2013
    Location
    Rome
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Creating a series of named ranges though VBA in a fast way

    Oh you are right, sorry!

    Attaching the file right now.
    So as you can see I have managed to create a dynamic chart for one of the time series in the file, however I'd have to do the same for all the series there.
    That's why I'd like to create something like a loop in VBA to create these charts in an automatic way...can you help me doing that?

    Many Many Thanks
    Attached Files Attached Files

  4. #4
    Forum Contributor lancer102rus's Avatar
    Join Date
    04-02-2014
    Location
    Ufa
    MS-Off Ver
    Excel 2010, 2013
    Posts
    252

    Re: Creating a series of named ranges though VBA in a fast way

    Check the sound
    Book1 (3).xlsm

  5. #5
    Registered User
    Join Date
    11-13-2013
    Location
    Rome
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Creating a series of named ranges though VBA in a fast way

    Hey lancer102rus, thanks a lot!

    However the charts you managed to create do not seem dynamic to me, they don't use named ranges and the offset function so they won't update ifd I change the forecast start year...any chance you know how to code that too? :D

    Thanks for your patience (I've never used VBA up to now so forgive me if this is really stupid....)

  6. #6
    Forum Contributor lancer102rus's Avatar
    Join Date
    04-02-2014
    Location
    Ufa
    MS-Off Ver
    Excel 2010, 2013
    Posts
    252

    Re: Creating a series of named ranges though VBA in a fast way

    OK. Is that what you need?
    Book1 (3).xlsm

  7. #7
    Registered User
    Join Date
    11-13-2013
    Location
    Rome
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Creating a series of named ranges though VBA in a fast way

    Yes that's it thanks

    Last thing, assume I want to do this for a more complex excel file with more sheets and data in it...what do I have to do create a macro like the one you called Module 1?
    can I export this macro exactly as it is in the other excel sheet (which has more sheets on top of the one called 'intermediate_output')?

    Can you suggest me a basic VBA textbook or website I can consult?

    Manu many thanks

  8. #8
    Forum Contributor lancer102rus's Avatar
    Join Date
    04-02-2014
    Location
    Ufa
    MS-Off Ver
    Excel 2010, 2013
    Posts
    252

    Re: Creating a series of named ranges though VBA in a fast way

    You can try to export this macro. May be it will work correct, may be not ))) depends on file.
    About basic VBA I can`t suggest smthng exactly. May be http://www.excel-easy.com/vba.html

+ 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. Combine 2 named-ranges for a single series line chart
    By ElmerS in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 12-02-2014, 07:21 PM
  2. [SOLVED] Named Ranges for Chart Series
    By NicholasL in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 07-31-2013, 08:50 PM
  3. Named Ranges for Chart Series
    By NicholasL in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-31-2013, 06:14 PM
  4. [SOLVED] Dynamic Named Ranges & Chart Series
    By stockgoblin42 in forum Excel Charting & Pivots
    Replies: 17
    Last Post: 05-15-2013, 01:31 AM
  5. Filling Named Ranges in Series
    By samueldips in forum Excel General
    Replies: 2
    Last Post: 08-09-2011, 01:09 PM

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