ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB code Required-------! (https://www.excelbanter.com/excel-programming/367350-vbulletin-code-required.html)

Thyagaraj

VB code Required-------!
 
Dear Friends,

I Want to delete a row based on the existence of a particular data.

ie.,

If any cell in the active sheet consists " Problem " then it should
delete the entire row....!

Can any body help..?


Thanks in Advance

Regards
Thyagaraj


Die_Another_Day

VB code Required-------!
 
Sub DeleteRows()
Dim FirstInstance As Range
Do
Set FirstInstance = Cells.Find(What:=" Problem ",
After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False)
If Not FirstInstance Is Nothing Then
FirstInstance.EntireRow.Delete
Loop While Not FirstInstance Is Nothing
End Sub

HTH

Die_Another_Day

Thyagaraj wrote:
Dear Friends,

I Want to delete a row based on the existence of a particular data.

ie.,

If any cell in the active sheet consists " Problem " then it should
delete the entire row....!

Can any body help..?


Thanks in Advance

Regards
Thyagaraj




All times are GMT +1. The time now is 08:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com