Results 1 to 3 of 3

Loop macro for multiple separate graphs from rows of a large data set

Threaded View

  1. #1
    Registered User
    Join Date
    07-30-2012
    Location
    Stellenbosch, South Africa
    MS-Off Ver
    Excel 2007
    Posts
    1

    Loop macro for multiple separate graphs from rows of a large data set

    (Please - Bear in mind i have very little VBA knowledge) (Use Excel 2007)

    I am working with large amounts of data from a doppler water current radar,

    My data is:
    1st row: C24-AB24 (which needs to be on Y-axis) (Heights of readings from sea floor)
    2nd row & all other rows: C25-AB252 down to C4938-AB4938 - Each row as source data for X-axis in each graph (X-axis) in seperate graphs (readings of shore velocity at each height)

    I am trying to create a macro that repeats the creation of graphs until the last row of data with some sort of loop command (for loop etc) - with each time selecting the next row (each row as X-source data for each graph).

    I.E. each iteration (i), the same Y-source row (first) but the X-source from the second row and each of the next rows each iteration - producing a graph every i,

    Please help me out to incorporate a loop command.

    This is a script i recorded for the graph I'm trying to automate

    ' Macro2 Macro
    '
    
    '
    
        ActiveSheet.Shapes.AddChart.Select
        ActiveChart.ChartType = xlXYScatterLines
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection(1).XValues = "='Sheet3'!$C$25:$AB$25"
        ActiveChart.SeriesCollection(1).Values = "='Sheet3'!$C$24:$AB$24"
        ActiveChart.Axes(xlCategory).Select
        ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.Axes(xlCategory).MinimumScale = 0
        ActiveChart.Axes(xlCategory).MinimumScale = -0.6
        ActiveChart.Axes(xlCategory).MaximumScale = 0.6
        ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.Axes(xlValue).Select
        ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.Axes(xlValue).MinimumScale = 0
        ActiveChart.Axes(xlValue).MaximumScale = 12
        ActiveChart.Axes(xlValue).MaximumScale = 11
        ActiveChart.Axes(xlValue).MajorUnit = 2
        ActiveChart.Axes(xlValue).MajorUnit = 1
        ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.ChartArea.Select
        ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.Axes(xlValue).MajorGridlines.Select
        Selection.Delete
        ActiveSheet.ChartObjects("Chart 1").Activate
    End Sub
    Any help will be much appreciated thanks
    Glenn Toms
    Stellenbosch, South Africa
    Last edited by Cutter; 07-30-2012 at 09:19 AM. Reason: Added code tags

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.6.0 RC 1