Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
delete the test values, but do not delete the formulas | Excel Discussion (Misc queries) | |||
How can I delete a macro when the Delete button is not active? | Excel Worksheet Functions | |||
How to Delete a Range in Closed Workbook (to Replace Delete Query) | Excel Discussion (Misc queries) | |||
How do i delete a macro in Excel 2003 when delete isn't highlight | Excel Discussion (Misc queries) | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions |