delete rows when finding certain content.
Hi,
try something like:
dim rg as range
''' find the cell
set rg= activesheet.range("a:a").Find
(what:=<your_text,lookin:=xlValues,...)
''' delete the rows bellow including rg
if not rg is nothing then
set rg=range(rg,rg.parent.cells(65536,1))
rg.entirerow.delete
end if
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
"me" wrote:
In a data containing worksheet, in column "A"
I would like to write a macro which finds the cell with content
"text2delete" and delete all the rows below including this "text2delete" row.
Something like below. Any help will be appreciated greatly. Thanks
Sub content_del()
$A = Find "text2delete" entered value at A1 column
then
Range(A$:A65000").Select
Selection.EntireRow.Delete
End Sub
or if it is easier this way,
delete all the rows A column value as "text2delete"
I guess this code should work for me.
Any help is greatly appreciated. Thanks..
|