View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Find Worksheet with Wildcard

dim wks as worksheet
dim CompWks as worksheet

set CompWks = nothing
for each wks in activeworkbook.worksheets
if lcase(wks.name) like "completed *" then
set compwks = wks
exit for
end if
next wks

if compwks is nothing then
'not found
'what should happen
else
'found it!
end if

philwongnz wrote:

Hi guys,

I like to know how to find a worksheet in a workbook in which I know
the name begins with the word "Completed". The trouble is I am not too
sure how you incorporate wildcard with the search as well, e.g. the
sheet could be called "Completed 0506"

After the search i would like to set that worksheet to a worksheet
variable as well, so i can acesss that worksheet for further data
access.

Many thanks

--
philwongnz
------------------------------------------------------------------------
philwongnz's Profile: http://www.excelforum.com/member.php...o&userid=26283
View this thread: http://www.excelforum.com/showthread...hreadid=565508


--

Dave Peterson