VBA; Select Variable Range

Solved
Hello,

I have a variable range from A5 to K.. that I want to select, but I can't do it;
I need help,
Thank you
Best regards

4 answers

  1. Hello,

    the principle

    Range(Range("A5"), Range("K65535").End(xlUp)).Select

    or more technically
    Range([A5], [K65535].End(xlUp)).Select
    --
    Cheers
    Mike-31

    I am responsible for what I say, not for what you understand...
    0
    1. Thank you Mike-31 for your response.
      Unfortunately, that doesn't work.
      I managed to select the last cell of the range using the following formula, but I couldn't go any further.
      [A65536].End(3).Offset(0, 10).Select]
      Best regards; JB22
      22 =1922, so 99 years, I can be excused!
      0
      1. Re,

        you have already set the status to resolved without having achieved satisfaction, the principle is to find the first non-empty cell by going up one column.
        in your case two possibilities, directly column K with this line of code
        [K65535].End(xlUp).Select

        or by offsetting the selection closer to your code
        [A65536].End(xlUp).Offset(0, 10).Select

        then we have a fixed selection point cell A5, just combine the two points
        Range([A5], [K65535].End(xlUp)).Select


        or starting from column A, offset to column K
        Range([A5], [A65536].End(xlUp).Offset(0, 10)).Select


        A+
        Mike-31

        I am responsible for what I say, not for what you understand...
        0
        1. It was by mistake that I put "Resolved"
          But with your last response, the problem is indeed resolved, thank you.
          Best regards, JB22
          0