Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default VBA Code for Deleting a Row

I would like to use a macro to delete any row that has the word
"delete" in one of its cells. What would this code be? Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default VBA Code for Deleting a Row

Sub zero()
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
For i = nLastRow To 1 Step -1
For j = 1 To Columns.Count
v = Cells(i, j).Value
If InStr(1, v, "delete") 0 Then
Cells(i, j).EntireRow.Delete
Exit For
End If
Next
Next
End Sub

--
Gary''s Student - gsnu200742


" wrote:

I would like to use a macro to delete any row that has the word
"delete" in one of its cells. What would this code be? Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default VBA Code for Deleting a Row

Try recording a macro
datafilterautofilterfilter on deletedeleteautofiter
or
look in the vba help index for FINDNEXT.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
ups.com...
I would like to use a macro to delete any row that has the word
"delete" in one of its cells. What would this code be? Thanks!


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default VBA Code for Deleting a Row

See also this page
http://www.rondebruin.nl/delete.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


wrote in message ups.com...
I would like to use a macro to delete any row that has the word
"delete" in one of its cells. What would this code be? Thanks!

Reply
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
deleting selected worksheets using vb code George Excel Discussion (Misc queries) 1 October 31st 06 05:14 PM
Deleting Workbook_Open code Paige Excel Discussion (Misc queries) 3 January 31st 06 07:39 PM
Deleting Code from VBA Noemi Excel Discussion (Misc queries) 1 January 24th 06 08:55 AM
programming VBE - Deleting All Code From A Module pm Excel Discussion (Misc queries) 4 December 31st 05 01:21 AM
Deleting ALL duplicates using Pearson's code [email protected] Excel Worksheet Functions 2 May 6th 05 01:50 PM


All times are GMT +1. The time now is 03:00 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"