Try the following macro. I have limited sort to columns A:AL. To be modified.
Sub test() Dim i As Long Application.ScreenUpdating = False For i = [A65536].End(xlUp).Row To 1 Step -1 If Cells(i, 4).Value <> "" Or (IsNumeric(Cells(i, 36)) And _ Cells(i, 36) < 99) Then Cells(i, 1).EntireRow.Delete End If Next i Range([A1], [AL65536].End(xlUp)).Sort [AL1], xlAscending End Sub Hope this helps. Daniel > -----Original Message----- > From: excel-macros@googlegroups.com [mailto:excel- > mac...@googlegroups.com] On Behalf Of Steve > Sent: samedi 18 juillet 2009 23:04 > To: MS EXCEL AND VBA MACROS > Subject: $$Excel-Macros$$ delete entire row based on single cell value > > > > This is my first experience with trying to write a macro instead of just record > one and it's not going very well. I researched this group and found what > looks to be a few similar macros but I don't know enough about VBA to get > them to work for me. Any help you can give me would be greatly > appreciated. > > My workbook will be a max of 500 rows. > > I would like to delete any row where column D contains data (it's a date > field). > > I would also like to delete any row where column AJ contains a number less > than 99. > > Sort the whole sheet in ascending order by column AL. > > I don't really care about the process (or what order it happens in), if there's > a way to do it all at once using some sort of OR command that'd be great (but > likely beyond what I could figure out). > If it could do it as 3 steps in the same macro that'd also be fine. > I'd even be ok running 2 macros back to back and then doing a manual sort > for column AL. > > I understand there is some issue about doing this from the top down, since > if I delete row 2 the macro moves to examine row 3, but the "original" row 3 > got moved up and is now row 2 so it's gets skipped. > Going from the bottom to the top is fine. > > I am still hacking away in VBA trying to get it to work but, not knowing VBA > and not being able to figure out some of the error messages has me a little > behind the curve. > > Thanks for any advice you can offer. > > Steve > sca...@aol.com > > > --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 5,000 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---