Setting the Range Object

  • I have a function that returns an alphabetical column label for each numerical column label, alphacol().


    I am getting a error on the "rng1.Value" line:

    Quote

    "Invalid Parameter"


    Code
    Dim rng1 As Range
                string1 = alphacol(15) & "4:" & alphacol(15) & "13"
                Set rng1 = Sheets("PlotData").Range(string1)
                Sheets("Graph").ChartObjects("Chart 1").Chart.SeriesCollection(1).XValues = rng1.Value


    If I replace the line:

    Code
    Sheets("Graph").ChartObjects("Chart 1").Chart.SeriesCollection(1).XValues = rng1.Value


    I also get the error:

    Quote

    "Invalid Parameter"

  • Re: Setting the Range Object


    As you haven't posted the User Defined Function (UDF) alphacol I can't help you with that. However, you don't need a UDF to convert a column number to a letter to set a range i.e. this will set the rng1 range variable to O4:O13:



    HTH


    Robert

Participate now!

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