Delete Cell Content Based on a Criteria

Posted on 2009-12-30
Last Modified: 2013-11-25
I want to be able to run a macro in an Excel spreadsheet (more specially 1 column) automatically delete the content of all cells in the column where the number of the cell is less than 100.

See the attached file for an example/visual.

Question by:ctownsen80
    LVL 14

    Accepted Solution

    This is setup to run on column A you can change as you wish.


    Sub KillLT100()
        Dim cnt As Long, mI As Long, TmpRng As Range
        cnt = ActiveSheet.UsedRange.Rows.Count
        For mI = 2 To cnt
            If Cells(mI, 1).Value < 100 Then Cells(mI, 1).ClearContents
    End Sub

    Open in new window


    Author Closing Comment



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
    This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now