VBA code to delete all rows when first cell contains a percentage

bjcowen90000

New Member
Joined
Nov 10, 2014
Messages
17
Hey, I want to loop through all worksheets and delete all rows that have a percentage anywhere in the first cell of each row. So if it 99.60%, it is deleted, if it is 99.5% it is also deleted. How can I do this just by specifying % and over all worksheets in my workbook?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi is this one related to your other post at all? The following code will do what you want:

Code:
    Dim i As Long
    Dim sh As Worksheet
    
    For Each sh In ActiveWorkbook.Sheets
        For i = sh.UsedRange.Rows.Count To 2 Step -1
            If Cells(i, 1).NumberFormat = "0%" Then Cells(i, 1).EntireRow.Delete
        Next i
    Next sh

But do you want it to work with the other post you made?
 
Upvote 0
I appreciate your help, but in the other thread I posted a change. What you did is great, but my data is more messed up that I thought. Can you check the other thread and alter the code to what I need now? It will save me a ton of time.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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