#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default If value delete row

I need to evaluate one column and if it contains specific text, then I want
the entire row's information cleared. If there a function or macro that could
do this?

Example
A B C D
NAME NUMBER DATE FINAL
1 John Doe 123 3/9/2007 Growth of
2 Jane Smith 456 3/9/2007 Bug1
3 Bill Doe 789 3/9/2007 BugA

In this case I would want row 1 to either have contents cleared or row 1 to
be deleted.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default If value delete row

Which particular part of row 1 was the selection criteria for the row being
deleted?

Mike

"Lost in Microbiology" wrote:

I need to evaluate one column and if it contains specific text, then I want
the entire row's information cleared. If there a function or macro that could
do this?

Example
A B C D
NAME NUMBER DATE FINAL
1 John Doe 123 3/9/2007 Growth of
2 Jane Smith 456 3/9/2007 Bug1
3 Bill Doe 789 3/9/2007 BugA

In this case I would want row 1 to either have contents cleared or row 1 to
be deleted.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default If value delete row

Sorry read your post again it must be John Doe that triggered the delete do
try:-

Sub Deleterows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If Cells(r, 1).Value = "John Doe" Then Rows(r).Delete
Next r
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Note this is case sensitive for John Doe. Will that do?

Mike

"Lost in Microbiology" wrote:

I need to evaluate one column and if it contains specific text, then I want
the entire row's information cleared. If there a function or macro that could
do this?

Example
A B C D
NAME NUMBER DATE FINAL
1 John Doe 123 3/9/2007 Growth of
2 Jane Smith 456 3/9/2007 Bug1
3 Bill Doe 789 3/9/2007 BugA

In this case I would want row 1 to either have contents cleared or row 1 to
be deleted.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default If value delete row

Mike,

Sorry, I was actually looking to evaluate the last column, "GROWTH OF"
This is lab information, where I have multiple rows of the same information,
and I just want the final result to be the bacteria name (i.e. Bug 1, Bug 2,
Bug A, etc.). I think I can adapt your suggestion to fit what I need, though.

"Mike" wrote:

Sorry read your post again it must be John Doe that triggered the delete do
try:-

Sub Deleterows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If Cells(r, 1).Value = "John Doe" Then Rows(r).Delete
Next r
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Note this is case sensitive for John Doe. Will that do?

Mike

"Lost in Microbiology" wrote:

I need to evaluate one column and if it contains specific text, then I want
the entire row's information cleared. If there a function or macro that could
do this?

Example
A B C D
NAME NUMBER DATE FINAL
1 John Doe 123 3/9/2007 Growth of
2 Jane Smith 456 3/9/2007 Bug1
3 Bill Doe 789 3/9/2007 BugA

In this case I would want row 1 to either have contents cleared or row 1 to
be deleted.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default If value delete row

Thanks for the reply. Simply change the column number from 1 to 4 to work on
column D and use:-

If UCase(Cells(r, 4).Value) = "YOURTEXT" Then Rows(r).Delete

if case is an issue

Mike

"Lost in Microbiology" wrote:

Mike,

Sorry, I was actually looking to evaluate the last column, "GROWTH OF"
This is lab information, where I have multiple rows of the same information,
and I just want the final result to be the bacteria name (i.e. Bug 1, Bug 2,
Bug A, etc.). I think I can adapt your suggestion to fit what I need, though.

"Mike" wrote:

Sorry read your post again it must be John Doe that triggered the delete do
try:-

Sub Deleterows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If Cells(r, 1).Value = "John Doe" Then Rows(r).Delete
Next r
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Note this is case sensitive for John Doe. Will that do?

Mike

"Lost in Microbiology" wrote:

I need to evaluate one column and if it contains specific text, then I want
the entire row's information cleared. If there a function or macro that could
do this?

Example
A B C D
NAME NUMBER DATE FINAL
1 John Doe 123 3/9/2007 Growth of
2 Jane Smith 456 3/9/2007 Bug1
3 Bill Doe 789 3/9/2007 BugA

In this case I would want row 1 to either have contents cleared or row 1 to
be deleted.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default If value delete row

That did the trick, thanks so much, my life just got a little easier...now
where did those winning lottery tickets go?

"Mike" wrote:

Thanks for the reply. Simply change the column number from 1 to 4 to work on
column D and use:-

If UCase(Cells(r, 4).Value) = "YOURTEXT" Then Rows(r).Delete

if case is an issue

Mike

"Lost in Microbiology" wrote:

Mike,

Sorry, I was actually looking to evaluate the last column, "GROWTH OF"
This is lab information, where I have multiple rows of the same information,
and I just want the final result to be the bacteria name (i.e. Bug 1, Bug 2,
Bug A, etc.). I think I can adapt your suggestion to fit what I need, though.

"Mike" wrote:

Sorry read your post again it must be John Doe that triggered the delete do
try:-

Sub Deleterows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If Cells(r, 1).Value = "John Doe" Then Rows(r).Delete
Next r
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Note this is case sensitive for John Doe. Will that do?

Mike

"Lost in Microbiology" wrote:

I need to evaluate one column and if it contains specific text, then I want
the entire row's information cleared. If there a function or macro that could
do this?

Example
A B C D
NAME NUMBER DATE FINAL
1 John Doe 123 3/9/2007 Growth of
2 Jane Smith 456 3/9/2007 Bug1
3 Bill Doe 789 3/9/2007 BugA

In this case I would want row 1 to either have contents cleared or row 1 to
be deleted.

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
delete the test values, but do not delete the formulas kathy Excel Discussion (Misc queries) 1 February 21st 07 07:03 PM
How can I delete a macro when the Delete button is not active? FCR Excel Worksheet Functions 0 March 9th 06 09:43 AM
How to Delete a Range in Closed Workbook (to Replace Delete Query) [email protected] Excel Discussion (Misc queries) 1 March 8th 06 10:10 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM


All times are GMT +1. The time now is 05:41 AM.

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"