View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AJ AJ is offline
external usenet poster
 
Posts: 99
Default VBA does not recognize Excel worksheet function "indirect"

I have a piece of Excel code as follows

Public Function Refer(ByVal SheetName, ByVal CellName) As Variant
Dim cellref As String
cellref = "'" & SheetName & "'!" & CellName
Refer = Indirect(cellref)
End Function

When I compile this VBA project, I get a 'function not defined' error on the
Indirect function.

Any ideas? I have ensured all VBA libraries are referenced.