Turn static range into a dynamic range

  • I have following code with static range.
    The letter "D" in the range must be a letter of last right column.

    Code
    Sub CreateChart()
        Range("C1:D1,C3:D6").Select   
        Range("C3").Activate
        ActiveSheet.Shapes.AddChart.Select
        ActiveChart.SetSourceData Source:=Range("'Report'!$C$1:$D$1,'Report'!$C$3:$D$6")
        ActiveChart.ChartType = xl3DColumnStacked100
        ActiveChart.PlotBy = xlRows
    End Sub


    How can I change this code to dynamic range. I tryed using XlToRight, but I have confused with that.
    Any idea?

  • Re: Turn static RANGE to dynamic


    Hello


    Why is there a (presumably empty) row in between the range (row 2)?


    If not, it is very convenient to use the CurrentRegion of cell C1. That will be fully dynamic.


    Wigi

    Regards,


    Wigi


    Excel MVP 2011-2014


    For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes


    -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!