vanessa h Wrote:
Hi,
I have an excel workbook which contains several excel worksheets. Now I
have one macro for deleting perticular rows. But I want to run the macro
only on the one of the worksheets in the workbook which contains the
word "Vanessa". i.e, if any of the worksheets contains the data
"Vanessa" then the delete rows macro should work for that perticular
worksheet only. And not for any other worksheet.
Can ayone help?
Vanessa h
Any of the worksheets contains word "Vanessa" - does it mean any of the
cells in the worksheet would have "Vanessa" as part of the larger string
and you want to scan all the sheets and all cells on the sheet for
occurence of "Vanessa" and delete a particular row from only those
sheets? Or name of a worksheet is "vanessa"? In earlier case you could
use Find method to look for "Vanessa" and loop through all sheets. But
if you have a large data on the sheets this is going to be quite slow.
I don't know how you are populating data on the sheets, but if you can
flag the sheet ( you could designate a particular cell on a sheet, say
A1 and write "1" there if data entered in any of the cells has
"Vanessa" or you can scan all the sheets once and flag those sheets
with "Vanessa") then your macro could only look for the flag and act on
those sheets instead of scanning all sheets for "Vanessa" everytime.
This will be much faster. If name of your sheet is "vanessa" then you
could just use .name property to look for the sheet.
A V Veerkar
--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile:
http://www.excelforum.com/member.php...o&userid=30338
View this thread:
http://www.excelforum.com/showthread...hreadid=504780