![]() |
Macro code for deleteing rows
See this page Dean
http://www.rondebruin.nl/delete.htm -- Regards Ron de Bruin http://www.rondebruin.nl "DeanT" wrote in message ... I have the below sheet and wish to write macro to delete entire rows that contain "SME" in category column. The size of sheet will vary as will the location of the rows within the sheet. I'm guessing I need a relative macro, but I can't come up with one that works. A B Category D xxx xxx PM y xgy xxx SME z sss xxx PM y ccc nnn SME d Thanks for your help. dean |
Macro code for deleteing rows
I have the below sheet and wish to write macro to delete entire rows that
contain "SME" in category column. The size of sheet will vary as will the location of the rows within the sheet. I'm guessing I need a relative macro, but I can't come up with one that works. A B Category D xxx xxx PM y xgy xxx SME z sss xxx PM y ccc nnn SME d Thanks for your help. dean |
Macro code for deleteing rows
Sub delete_sme_rows()
Dim r As Range, j As Long Set r = ActiveSheet.UsedRange j = r.Rows.Count + r.Row Set rdel = Cells(j, "A") For i = 1 To j - 1 If Cells(i, "C").Value = "SME" Then Set rdel = Union(rdel, Cells(i, "A")) End If Next rdel.EntireRow.Delete End Sub Looks in column C -- Gary's Student "DeanT" wrote: I have the below sheet and wish to write macro to delete entire rows that contain "SME" in category column. The size of sheet will vary as will the location of the rows within the sheet. I'm guessing I need a relative macro, but I can't come up with one that works. A B Category D xxx xxx PM y xgy xxx SME z sss xxx PM y ccc nnn SME d Thanks for your help. dean |
All times are GMT +1. The time now is 06:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com