View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_714_] Leith Ross[_714_] is offline
external usenet poster
 
Posts: 1
Default VBA does not recognize Excel worksheet function "indirect"


AJ;165121 Wrote:
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.


Hello AJ,

You're right. VBA doesn't support the worksheet function "Indirect".
You can achieve the this by taking the Range of a Range.

Refer = Range(Range(cellref))

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45837