+ Reply to Thread
Results 1 to 6 of 6

Clear range of cells 'to the bottom of the spreadsheet'

  1. #1
    Registered User
    Join Date
    08-29-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Clear range of cells 'to the bottom of the spreadsheet'

    Hi

    Have some varying number of results displayed that could be all the way to the bottom of the spreadsheet, but starting at a certain point down the column already (just below a cell I've named 'wienerOutputT' and need to first clear the entire area.

    If always had N rows, this is what I'd do (in fact, that range is where the output goes):

    Please Login or Register  to view this content.
    How can I first clear 'all the way down' where N is the bottom (or max row perhaps) please? This is literally my first day with Excel so apologies if easy one.

    Thanks in advance,

    Color
    Last edited by colorrider; 08-29-2010 at 09:53 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Clear range of cells 'to the bottom of the spreadsheet'

    Hi colorrider, welcome to the forum.

    Be sure to read through the Forum Rules so you can use and follow them effectively. For instance, you'll need to EDIT that post above and put code tags around that code you used. (Like shown in my signature)

    ...or just remove the code. Your question is really a simple "how do you reference the last row of the worksheet in a variable" and we don't need your code to answer that.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Clear range of cells 'to the bottom of the spreadsheet'

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    08-29-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Clear range of cells 'to the bottom of the spreadsheet'

    Sorry about that, I've corrected it now.

    Since posting, I have found

    Please Login or Register  to view this content.
    property but is there a way to define a Range "to the bottom" (without doing some, albeit trivial, arithmetic).

    Thanks

    Color

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Clear range of cells 'to the bottom of the spreadsheet'

    Do you mean that you want to clear the contents of a named range from a certain row in that range to the end of the range?

    I assume Range("wienerOutputT") is a named range

    If so try this
    Please Login or Register  to view this content.
    If you just want to find the last used row in a column
    Please Login or Register  to view this content.

    Perhaps if you were to post a sample workbook showing before and after we might give a clearer answer.

    [EDIT]
    I have added a demo workbook
    Change n in the code as you wish

    I have used .Select in the example to show how it works
    You should use .ClearContents in your final code

    or perhaps use this line instead
    Please Login or Register  to view this content.
    Select the whole table and drag it any where in the sheet and the code will still work.

    Hope this helps
    Attached Files Attached Files
    Last edited by Marcol; 08-29-2010 at 09:18 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Registered User
    Join Date
    08-29-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Clear range of cells 'to the bottom of the spreadsheet'

    Thanks very much Marcol - you were spot on. Was really good of you to make a workbook too.

    Color

+ 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