View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernie Deitrick
 
Posts: n/a
Default Tracking worksheet names in functions

Mark,

You would need to use VBA to create a custom function: copy the function below into a regular code
module, and use it like so:

=IF(ShtExists("Tuesday"),1,0)
or
=IF(ShtExists("Tuesday"),"Tuesday exists","Tuesday doesn't exist")

HTH,
Bernie
MS Excel MVP


Function ShtExists(myName As String) As Boolean
Dim mySht As Worksheet
ShtExists = False
For Each mySht In Application.Caller.Parent.Parent.Worksheets
If mySht.Name = myName Then
ShtExists = True
Exit Function
End If
Next mySht
End Function


"locutus243" wrote in message
...

Hey guys, bit of a puzzler for you:-

I am trying to create a formula that is based on worksheet names, such
as 'If a worksheet called 'Tuesday' exists then type 1. Is there anyway
that worksheet names can be used in this way??

Thanks

Mark


--
locutus243
------------------------------------------------------------------------
locutus243's Profile: http://www.excelforum.com/member.php...o&userid=12862
View this thread: http://www.excelforum.com/showthread...hreadid=490724