Need help with a delete macro

Buns1976

Board Regular
Joined
Feb 11, 2019
Messages
194
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I have a worksheet with close to 1000 rows. I want to delete ALL rows where the VALUE in Column A DOES NOT
BEGIN with ZERO with a macro.

Any help would be appreciated!

Thank you!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Is col A text, or numbers that are formatted to show leading 0s
 
Upvote 0
Fluff,

I think I got it if this looks correct to you?

Code:
With Range("A2", Range("A" & Rows.Count).End(xlUp))     
 .Value = Evaluate(Replace("if(left(@,1)=""0"",@,"""")", "@", .Address))
      .SpecialCells(xlBlanks).EntireRow.Delete
   End With
<style> UL { cursor: hand; } UL LI { display: none;font: 90%;list-style: square; } UL.showList LI { display: block; } .defaultStyles UL { color: black; } UL.defaultStyles LI { display: none; } </style><style>UL { cursor: hand; } UL LI { display: none;font: 90%;list-style: square; } UL.showList LI { display: block; } .defaultStyles UL { color: black; } UL.defaultStyles LI { display: none; }</style><style> UL { cursor: hand; } UL LI { display: none;font: 90%;list-style: square; } UL.showList LI { display: block; } .defaultStyles UL { color: black; } UL.defaultStyles LI { display: none; } </style><style>UL { cursor: hand; } UL LI { display: none;font: 90%;list-style: square; } UL.showList LI { display: block; } .defaultStyles UL { color: black; } UL.defaultStyles LI { display: none; }</style><style> UL { cursor: hand; } UL LI { display: none;font: 90%;list-style: square; } UL.showList LI { display: block; } .defaultStyles UL { color: black; } UL.defaultStyles LI { display: none; } num {text-align:right;} text {text-align: left;} </style><style> UL { cursor: hand; } UL LI { display: none;font: 90%;list-style: square; } UL.showList LI { display: block; } .defaultStyles UL { color: black; } UL.defaultStyles LI { display: none; } </style><style> UL { cursor: hand; } UL LI { display: none;font: 90%;list-style: square; } UL.showList LI { display: block; } .defaultStyles UL { color: black; } UL.defaultStyles LI { display: none; } </style>
 
Last edited:
Upvote 0
Does it work?
 
Last edited:
Upvote 0
Hi Fluff,
It works BUT its messing up another macro so I need to change it. Stay tuned.

Thank you!
 
Upvote 0
Hi Fluff,
It works BUT its messing up another macro so I need to change it. Stay tuned.
I don't see how that code could mess up another macro. If I had to guess, I'd say your other macro is not coping with the row removals correctly (possibly still using original row information against the now reduced number of rows).
 
Upvote 0
Hi Fluff,

I was able to get this resolved.

Thanks for your help!!
 
Upvote 0
Glad you sorted it & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,619
Members
449,039
Latest member
Mbone Mathonsi

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