+ Reply to Thread
Results 1 to 2 of 2

Thread: Loop Rows of Data and Create Graphs

  1. #1
    Registered User
    Join Date
    11-24-2008
    Location
    Abilene, KS
    Posts
    4

    Cool Loop Rows of Data and Create Graphs

    I have data on one sheet:
    Day Day Day Day Day
    Store #
    Store #
    Store #

    I would like to create a graph for a specific time period (7 days) for each store on a new sheet. This is what I have so far:

    Sub Macro2()
     ' Set Do loop to stop when two consecutive empty cells are reached.
          Do Until IsEmpty(ActiveCell) And IsEmpty(ActiveCell.Offset(1, 0))
             
            
        ActiveSheet.Shapes.AddChart.Select
        ActiveChart.ChartType = xlLineMarkers
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection(1).Name = "=Sheet1!$B3"
        ActiveChart.SeriesCollection(1).Values = "=Sheet1!$C3:$H3"
        ActiveChart.SeriesCollection(1).XValues = "=Sheet1!$C$2:$H$2"
        Range("B18").Select
        ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.ChartArea.Copy
        ActiveWindow.SmallScroll Down:=9
        Range("B18").Select
        
     ActiveCell.Offset(2, 0).Select
          Loop
    End Sub
    I know something is wrong with my loop statement and I can't figure out how to make it create a new sheet for each graph. Forgive me, I'm a newbie to VBA.

    Any help is greatly appreciated. Thanks, in advance!

    Cindy

  2. #2
    Forum Guru
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    5,359

    Re: Loop Rows of Data and Create Graphs

    Hi

    Why do you need to create a new graph for each item? Why not create one graph, and have a selection process that allows you to select each store and have the graph update for the selected store?


    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0