+ Reply to Thread
Results 1 to 9 of 9

Graphing dynamic range with vba

Hybrid View

Katsdog Graphing dynamic range with... 04-29-2013, 09:28 PM
AlphaFrog Re: Graphing dynamic range... 04-29-2013, 10:23 PM
Katsdog Re: Graphing dynamic range... 04-29-2013, 10:39 PM
Katsdog Re: Graphing dynamic range... 04-29-2013, 10:55 PM
AlphaFrog Re: Graphing dynamic range... 04-29-2013, 10:53 PM
Katsdog Re: Graphing dynamic range... 04-29-2013, 11:00 PM
AlphaFrog Re: Graphing dynamic range... 04-29-2013, 11:11 PM
Katsdog Re: Graphing dynamic range... 04-29-2013, 11:22 PM
Katsdog Re: Graphing dynamic range... 04-29-2013, 11:28 PM
  1. #1
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Graphing dynamic range with vba

    I couldn't figure out which dates you wanted to chart. So I just charted all the dates that had data (E5:M7) in your example workbook. The dates should appear on the x axis.

    Sub NewGraph_A4()
     
        ActiveSheet.ChartObjects.Delete
        
        With ActiveSheet.ChartObjects.Add _
            (Left:=150, Width:=800, Top:=150, Height:=400)
            
            With .chart
                
                '.SetSourceData Source:=Range("wkly_alabaster_b", "wkly_alabaster_c")
                .SetSourceData Source:=Sheets("Sheet1").Range("E5:M7"), PlotBy:=xlRows
                            
                .ChartType = xlLine
                .Axes(xlCategory).TickLabels.Orientation = xlUpward
                .Legend.Font.Size = 13
                
                With .Axes(xlValue)
                    .MajorUnit = 0.1
                    .MinorUnit = 0.1
                    .MaximumScale = 1
                End With
                .Axes(xlValue, xlPrimary).TickLabels.Font.Size = 15
                .Axes(xlCategory, xlPrimary).TickLabels.Font.Size = 15
                
                .SeriesCollection(1).Name = "Physical"
                .SeriesCollection(2).Name = "Economic"
                
                .HasTitle = True
                With .ChartTitle
                    .Text = Worksheets("Sheet1").Range("A4").Value
                    .Font.Name = "Calibri"
                    .Font.FontStyle = "Regular"
                End With
                
            End With
            
        End With
         
    End Sub

  2. #2
    Registered User
    Join Date
    02-27-2013
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Graphing dynamic range with vba

    Thank you for the reply. There is one more thing I need to mention.
    The ranges are dynamic and you can see that when you go to Name Manager and see what the named ranges are.
    There is a lot going on in terms the Offset function. When you change the number in the top leftmost cell in the sheet, the number of cells in the range is selected accordingly.
    I cannot simply use the correction above because it's is very important that I keep that dynamic functionality.

  3. #3
    Registered User
    Join Date
    02-27-2013
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Graphing dynamic range with vba

    Here are the instructions I used- http://peltiertech.com/Excel/Charts/DynamicLast12.html

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