Deleting cells with a value

Rahiem

New Member
Joined
Mar 2, 2009
Messages
17
I need help creating a macro that can clear all cell contents in columns L (L:L) and N (N:N) to the end of the Data and only cells with values greater than zero. Please help me if you can paste the code in the thread notes. Thanks so much in advance for your assistance. Have a nice day.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
you don't really need a macro, just the autofilters and select custom and in the drop-down choose greater than. Then you can select the data and press delete.
 
Upvote 0
Hi Rahiem:

Just to add to what texasalynn was stating. If you use the Macro Recorder and do the Autofilter Route you can get the code. Remember when trying anyones code ALWAYS try it on a TEST Copy of your spreadsheet so you don't mess up your original copy. Here is a sample of the code I got from using Autofilter and Macro Recorder to clear ALL But Zeros from Columns L and N:

Code:
Sub DeleteAllButZero()
'
' DeleteAllButZero Macro
' Macro recorded 06/03/2009
'
'
    Columns("L:L").Select
    Selection.AutoFilter
    Selection.AutoFilter Field:=1, Criteria1:="<>0", Operator:=xlAnd
    Selection.ClearContents
    
    Columns("N:N").Select
    Selection.AutoFilter
    Selection.AutoFilter Field:=1, Criteria1:="<>0", Operator:=xlAnd
    Selection.ClearContents
    
    Range("A1").Select
    
End Sub

Good Luck,
Mark :)
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top