View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Possible to refer to a sheet's object name ?

kittronald laid this down on his screen :
Garry,

Ok, it's been a while since I've been able to get back to this UDF due to
other processes having to work first.

What is the syntax of the workbook argument when using the UDF in a cell
?

In VB, using Activeworkbook works, but in a cell, the #VALUE error keeps
resulting.



- Ronald K.


Make the following change to the args declaration, and ignore the Wkb
arg when using in a cell.

Function Get_SheetTabName(CodeName As String, Optional Wkb As Workbook)
As String
Dim Wks As Worksheet
If Wkb Is Nothing Then Set Wkb = ActiveWorkbook '//add this line
For Each Wks In Wkb.Worksheets
If Wks.CodeName = CodeName Then _
Get_SheetTabName = Wks.Name: Exit Function
Next
End Function

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc