LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to avoid deleteing certain rows? E.J. van Wijngaarden[_2_] Excel Programming 0 June 16th 05 05:23 PM
Deleteing some Rows Deepwater Excel Discussion (Misc queries) 1 April 1st 05 06:23 PM
Deleteing Rows Michael Vaughan Excel Programming 2 September 20th 04 09:53 PM
Deleteing Duplicate Rows??? James Excel Programming 13 June 4th 04 03:24 PM
Deleteing Rows Amber[_2_] Excel Programming 3 February 4th 04 06:34 PM


All times are GMT +1. The time now is 06:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"