Tracking worksheet names in functions
One way, using a User Defined Function:
Public Function SheetExists(sName As String) As Boolean
Dim sTemp As String
Application.Volatile
On Error Resume Next
sTemp = Sheets(sName).Name
SheetExists = Err = 0
On Error GoTo 0
End Function
Call as
=IF(SheetExists("Tuesday"),1,"something else")
or perhaps
=--SheetExists("Tuesday")
In article ,
locutus243
wrote:
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
|