+ Reply to Thread
Results 1 to 4 of 4

Clear contents of last used cell in a range and those previous to it (excel 2003)

  1. #1
    Registered User
    Join Date
    09-03-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    17

    Clear contents of last used cell in a range and those previous to it (excel 2003)

    Hi

    I have two sheets with cells in ranges that I want to be able to clear the contents of. Sheet2 range is A2:C30 Sheet6 range is A10:C30.
    So for example, in sheet6 if all of the cells in the range have content and I hit the clear button it would clear the content in C30.
    If I hit again it would then clear the content in B30 and again the content in A30. If I repeatedly hit the button it would clear the
    content all the way back to A10. Within this range there could be some blank cells, but I assume since its blank the code would
    find the next used cell prior to it. It must stop at A10 as there is data in cells previous to this that I don't want to clear. I have
    managed to clear contents of entire rows in this range but have not been successful for individual cells.

    Thanks
    Chris

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Clear contents of last used cell in a range and those previous to it (excel 2003)

    Give this a try

    Please Login or Register  to view this content.
    Last edited by mike7952; 08-16-2012 at 03:11 PM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Clear contents of last used cell in a range and those previous to it (excel 2003)

    Hello Chris,

    Here is macro that clear the cells on Sheet2. This will clear the cells starting in the last row and last column. Each time it is run, it will clear the next cell from the end that has a value. It will clear only one cell each time it is called.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    09-03-2009
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Clear contents of last used cell in a range and those previous to it (excel 2003)

    Hey Leith, Mike
    Thanks for the nice solutions! This is essentially the "undo" button I had be wanting to integrate into the code for a while now.

    Chris

+ 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