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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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,837
Messages
6,121,883
Members
449,057
Latest member
Moo4247

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