+ Reply to Thread
Results 1 to 5 of 5

Adaptive cell range

  1. #1
    Forum Contributor
    Join Date
    10-16-2012
    Location
    Brooklyn
    MS-Off Ver
    Excel 2010 PC
    Posts
    137

    Adaptive cell range

    Hey,

    I'm trying to get a cell range to increase to match my data size, every time the macro is ran.

    Basically, I have a range ("B2:K20") that I'm copying and pasting over one column, to ("C2:L20").

    Now, the next time I run the macro to copy and paste this range, the range I want to capture is 1 column larger. So the next range, after copying and pasting the first range to the right, would be ("B2:L20").

    How can I make my range equal the number of columns I want to capture? It might help to add that there is nothing to the right of the cell range I'm trying to target.

    Thanks in advance

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Adaptive cell range

    Hey!!

    You will have to find the Last Column. You can use -

    Please Login or Register  to view this content.
    Then you can refer the Range using LC in place of Column References.

    Thank You,

    Deep
    Cheers!
    Deep Dave

  3. #3
    Forum Contributor
    Join Date
    10-16-2012
    Location
    Brooklyn
    MS-Off Ver
    Excel 2010 PC
    Posts
    137

    Re: Adaptive cell range

    Hey ExcelatHome

    Thanks for the code. I'm trying to insert it into my macro but there's something wrong with my syntax.
    I'm not sure how to add that integer into my cell range. Any help is appreciated. This is what I have so far.

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 05-14-2013 at 11:38 AM.

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Adaptive cell range

    Hey!!

    This line is wrong!

    Range("K5:VLC").Select
    What Range do you exactly want?

    Thank You,

    Deep

  5. #5
    Forum Contributor
    Join Date
    10-16-2012
    Location
    Brooklyn
    MS-Off Ver
    Excel 2010 PC
    Posts
    137

    Re: Adaptive cell range

    Hey Deep.

    This might help make my problem more clear.

    Thanks for your patience.
    Attached Files Attached Files

+ 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