Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Delete Cell Content Based on a Criteria

Posted on 2009-12-30
2
Medium Priority
?
232 Views
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.


Delete-Content-based-on-Criteria.xlsx
0
Comment
Question by:ctownsen80
2 Comments
 
LVL 14

Accepted Solution

by:
Tommy Kinard earned 2000 total points
ID: 26145970
This is setup to run on column A you can change as you wish.

dragontooth


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
    Next
End Sub

Open in new window

0
 

Author Closing Comment

by:ctownsen80
ID: 31671212
EXCELLENT!

THANKS,
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

571 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