ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Never tried this location in excel (https://www.excelbanter.com/excel-programming/381231-re-never-tried-location-excel.html)

NickHK

Never tried this location in excel
 
Curt,
If you mean with a worksheet function, then No. This can only return a
value. e.g.

Public Function InvalidWorksheetFunction(argValue As Variant) As Long
Debug.Print Application.Caller.Offset(0, -1).Address
Application.Caller.Offset(0, -1).Value = argValue
InValidWorksheetFunction = 1
End Function

However, called from VBA, this is valid
Public Function ValidFunction(argBase As Range, NewValue As Variant,
Optional ColOffset As Long = -1) As Boolean
argBase.Offset(0, ColOffset).Value = NewValue
ValidFunction = True
End Function
although you should add checking of a valid Offset, so you are not off the
sheet.

NickHK

"Curt" wrote in message
...
Is it possible to call a procedure and have excel put in cell address of
calling location. Have a procedure that must be called from many

locations
and return data to location in precedding column.
Never tried this.





All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com