+ Reply to Thread
Results 1 to 5 of 5

Select a dynamic range

  1. #1
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Select a dynamic range

    Greetings, Gurus.

    This will be an easy on for you seasoned programmers. I want to find the last used cell in a column, and then select an offset range based on the location of that cell.

    For example, in the attached workbook, I have a button at the top that activates a macro to add a new week to my time sheet. This simply copies the contents of the current week, and adds it at the bottom.

    What I would like to do next is clear the data from the newly added cells, leaving the formulas in columns A, B, C, J and K.

    In the attached example, I have just added Week 3. I would now want to locate the last used cell in Column C, (C24), then offset from that cell to select the range D18:I24, and clear the contents of those cells.

    Thanks in advance for any help you can offer.
    Attached Files Attached Files
    Last edited by [email protected]; 01-09-2009 at 11:18 AM.

  2. #2
    Registered User
    Join Date
    03-16-2004
    Posts
    65
    This will fix that for you...

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    To make your initial code flexible as well try:
    Please Login or Register  to view this content.
    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2008
    Location
    Tennessee
    MS-Off Ver
    Office 2007
    Posts
    706

    Thanks!

    Thanks, Guys.

    I went with Broro's suggestion, because it also fixed the problems in my initial macro, and it worked perfectly.

    Have a good one!

  5. #5
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243
    Thanks for the feedback - I'm pleased we could help :-)

    Rob

+ 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