Range to work from a string.

  • I have made a function that converts column numbers to column letters, alphacol.

    I am having trouble reading the Range, rng1 after it has been set.

    There is an error: "Object does not support this property or method"
    on line: "Sheets("Graph").ChartObjects("Chart 1").Chart.SeriesCollection(k).XValues = Sheets("PlotData").rng1"

    If I change rng1 to Range(rng1) I get this error: "Application-defined or object-defined error"
    on this line: "Sheets("Graph").ChartObjects("Chart 1").Chart.SeriesCollection(k).XValues = Sheets("PlotData").Range(rng1)"

    How do I get the Range to work with the function?

  • Re: Range to work from a string.

    Rng is a variable, not a property of a sheet. When you assign a range to it, the range is specific to a sheet, so you don't need to try and qualify the variable with a sheet too. Anyway, I'd just use the address string directly

    Sheets("Graph").ChartObjects("Chart 1").Chart.SeriesCollection(k).XValues = "=PlotData!" & String1

    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

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