View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Is Application.Caller valid in Functions but not Subs?

This property returns information about how Visual Basic was called, as shown
in the following table.

Caller Return value
A custom function entered in a single cell retirms
A Range object specifying that cell

A custom function that is part of an array formula in a range of cells returns
A Range object specifying that range of cells

An Auto_Open, Auto_Close, Auto_Activate, or Auto_Deactivate macro returms
The name of the document as text

A macro set by either the OnDoubleClick or OnEntry property returns
The name of the chart object identifier or cell reference (if applicable) to
which the macro applies

The Macro dialog box (Tools menu), or any caller not described above returns
The #REF! error value



" wrote:

This works fine in all Functions I've written but throws an 'Object
required' in a Sub I'm writing:

Dim R as Range
Set R = Application.Caller

If Application.Caller is invalid in a Sub, then what expression DO you
use in a Sub to return the cell the user was on when he launched the
Sub?

Thanks much.

***