Macro to delete certain rows

polly

Board Regular
Joined
Apr 5, 2002
Messages
55
Yes I like it. Changed it some what to suit my needs. Thx alot. INT() is a new one for me I can use that alot. Remember to save first or it will get ugly.

Been gone awhile
Paul
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I am sure this has been covered but I not getting any results on the search. I would like a macro to look down a column of numbers (10,000 rows)and delete the entire row (or hide the row) that doesn't have a whole number in it. Like this:
240.00 keep row
256.02 delete row
564.46 delete row
560.00 keep row
............
there are 2 other columns of numbers along side the row in question, and those numbers would be deleted or (hide) along with the non whole numbers.
Is this possible.
I tried endlessly but my macro ability is early beginer at best. And with so many command choices....well you know.

Paul
 
Upvote 0
Assuming your numbers are in column A ;-

Dim rng As Range
Set rng = Range([A1], [A65536].End(xlUp))
rng.EntireColumn.Insert
With rng.Offset(0, -1)
.FormulaR1C1 = "=IF(RC[1]-INT(RC[1])=0,1,"""")"
On Error Resume Next
.SpecialCells(xlCellTypeFormulas, 2).EntireRow.Delete
On Error GoTo 0
.EntireColumn.Delete
End With
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,972
Members
448,537
Latest member
Et_Cetera

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