View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Worksheet Codenames Passing to Function


Must be one of those days <g...
Change With xSh to With searchSh
Change xFind to searchText
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Nigel"
wrote in message
Hi All
I wish to pass a worksheet codename to function. How do I do this?
So far......this fails to pass the codename shAIF to the function
Sub Test
MsgBox FindReport(shAIF, "New Report")
End Sub

Function FindReport(searchSh as Worksheet, searchText as String) as Long
FindReport = 0
Dim c
With xSh
Set c = .Cells.Find(xFind, LookIn:=xlValues)
If Not c Is Nothing Then
FindReport = c.address.Row
End If
End With
End Function
--
Regards,
Nigel