+ Reply to Thread
Results 1 to 4 of 4

Find Last Row of Data in One Column and Delete Everything Below it

Hybrid View

  1. #1
    Registered User
    Join Date
    06-23-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    47

    Find Last Row of Data in One Column and Delete Everything Below it

    I would like to locate the last row of data in column z and then delete everything in the worksheet below that row. Many thanks in advance to anyone willing to help. Test.zip

  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: Find Last Row of Data in One Column and Delete Everything Below it

    Dim LR as Long
    
    LR = Range("Z" & Rows.Count).End(xlUp).Row + 1
    
    Range(LR & ":" & Rows.Count).ClearContents
    _________________
    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
    Registered User
    Join Date
    06-23-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Find Last Row of Data in One Column and Delete Everything Below it

    Thank you for your help JBeaucaire. One more question if you don't mind. I'd like to take the contents of cell "T2" and copy and paste it in all cells below it until the LR referenced in your code above. I did attempt to do this on my own but I'm not getting the syntax quite right.

    ---------- Post added at 10:49 AM ---------- Previous post was at 10:35 AM ----------

    I tried this but it's not working

    Range("T2").AutoFill Destination:=Range("t3:T" & LR), Type:=xlFillDefault


    ---------- Post added at 11:49 AM ---------- Previous post was at 10:49 AM ----------

    Anyone can feel free to correct my code, it doesn't have to be Jbeaucaire... and thanks in advance.

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

    Re: Find Last Row of Data in One Column and Delete Everything Below it

    I don't use Autofill.

    Range("T2").Copy Range("T3:T" & LR)

+ 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