Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Normally to call a worksheet function in VBA need to do it like this
result = Application.WorksheetFunction.funcName() However, as macropod has pointed out, Indirect is not an available WorksheetFunction. But why not simply - Refer = Range(cellref).Value or Refer = Worksheets(SheetName).Range(CellName).Value or if you already have a reference to the sheet as is typically the case Refer = ws.Range(CellName).Value (using your argument names and assuming all is to refer to the Active workbook) Regards, Peter T "AJ" wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Turn off "CALCULATE" on bottom of Excel worksheet. near "Ready" | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Excel "Worksheet Name" Building Function for Summary Sheet | Excel Discussion (Misc queries) | |||
VBA does not recognize Excel worksheet function "indirect" | Excel Programming | |||
Excel VBA, won't recognize "Word.Application" object | Excel Programming |