+ Reply to Thread
Results 1 to 2 of 2

Clear contents from all Rows below the last non-empty cell of a column

Hybrid View

  1. #1
    Registered User
    Join Date
    02-26-2016
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    5

    Clear contents from all Rows below the last non-empty cell of a column

    Hi guys,

    I Built a small macro which allows me to autofill a certain formula (in column N) along with a dataset (from column A to M ). The problem is that, since the dataset is refreshing everyday, the number of rows of the dataset day by day is different. In case the data set is longer, the autofill formula will take care of that. In case the data set is shorter compared to the day before, there will be some formulas in excess that I don't want.

    How can I cope with this ? I thought to write another macro which allows me to detect the last non-empty cell in column A and clear all the contents in the all the rows below that cell.

    That said, could someone help to build this clear-contents macro ?

    Thank you very much !!!

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,862

    Re: Clear contents from all Rows below the last non-empty cell of a column

    Try:
    sub test()
    dim lr&
    lr=cells(rows.count,"A").end(xlup).row
    Range(cells(lr+1,"A"),cells(rows.count,"F")).clearcontents 'adjust columns to your needs
    end sub
    not tested (written in forum editor, but shall do the work)
    Best Regards,

    Kaper

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Clear contents of specific cells on the same row if a specific cell on that row is empty
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2014, 01:48 PM
  2. Replies: 3
    Last Post: 01-08-2013, 01:27 PM
  3. Delete rows or Clear contents below a specific word is found in Column A
    By kishoremcp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-17-2012, 04:08 PM
  4. [SOLVED] Clear cell contents of duplicates within column
    By davegscott in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2012, 06:26 PM
  5. [SOLVED] Macro to clear cell contents in all but 1 column of specified rows
    By HelderPT in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2012, 12:47 PM
  6. [SOLVED] VBA code to automatically clear a cells contents when another cell is empty
    By masso1980 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-25-2012, 10:52 PM
  7. Clear Contents of every other cell in one column
    By norolimfrodo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-06-2011, 12:46 PM

Tags for this Thread

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