+ Reply to Thread
Results 1 to 6 of 6

how to select a range and then add a specific number of cells after it

  1. #1
    Registered User
    Join Date
    03-19-2012
    Location
    rochester, ny
    MS-Off Ver
    Excel 2013
    Posts
    14

    how to select a range and then add a specific number of cells after it

    Hello all,
    I would like to select a range and add a specific number of cells to it. This is what I have so far:

    Please Login or Register  to view this content.
    i want to do something like ("a3:b2+2") for a range but am unsure how to write the +2 part. Any help is greatly appretiated.
    Thanks,
    dustin

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: how to select a range and then add a specific number of cells after it

    Not sure what you mean,
    Your code nowhere matches what you want.
    Please Login or Register  to view this content.
    Your code will select A2:B(whatever number you have in I21)
    What does it have to do with
    ("a3:b2+2")?

  3. #3
    Registered User
    Join Date
    03-19-2012
    Location
    rochester, ny
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: how to select a range and then add a specific number of cells after it

    sorry. the look back period is in days which in that cell. if i21 is 12 days then the range would be a3:b12. What I want to be is a3:b14. if cell i21 was 20 I would want the range to be a3:b22. I want to add 2(or any specific number) to the number part of the range.

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: how to select a range and then add a specific number of cells after it

    Is this not working for you?

    Please Login or Register  to view this content.
    Last edited by abousetta; 04-02-2012 at 10:46 PM. Reason: Should be Long instead of String
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Registered User
    Join Date
    03-19-2012
    Location
    rochester, ny
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: how to select a range and then add a specific number of cells after it

    wow that was easy enough. i never tried putting the +2 inside the ampersand symbols, I was writing it as "a3:b" & lookbackperiod & "+2". Do you know why this doesnt work? I get "Method Range' of object '_Global' failed"
    thanks for the answer.

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: how to select a range and then add a specific number of cells after it

    Hi,

    The reason is what the final product looks like. If you say:

    Please Login or Register  to view this content.
    this is translated into

    Please Login or Register  to view this content.
    See the problem Excel is now trying to go use b10+2 as a range which in it's thinking is not the same as b12.

    Hope this helps.

    abousetta

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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