Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Referencing "current" row (not using ActiveCell.Row)

This must be easy, but I'm being a bit stupid here as I can't find the
method that I'm after.

I have a custom volatile function that I want to return the row in which the
function is used - not the active row. (Actually, it does a lot more, but
this is the crux of the problem.)

So:

Function GetRow()
Application.Volatile (True)
GetRow = Application.ActiveCell.Row
End Function

doesn't work because if I click away from the cell that uses the function,
the cell then gets the value of the active cell and not the one in which the
function is used. After much searching on MS and Google, I admit that I'm
stumped. :-|

Any ideas?

TIA
MArk


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Referencing "current" row (not using ActiveCell.Row)

Function CallerAddr()
Application.Volatile
CallerAddr = Application.Caller.Address(external:=True)
End Function
Function CallerRow()
Application.Volatile
CallerRow = Application.Caller.Row
'This must be part of s'thing else
'=ROW() would be lots more efficient
End Function





keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Mark" wrote:

This must be easy, but I'm being a bit stupid here as I can't find the
method that I'm after.

I have a custom volatile function that I want to return the row in
which the function is used - not the active row. (Actually, it does a
lot more, but this is the crux of the problem.)

So:

Function GetRow()
Application.Volatile (True)
GetRow = Application.ActiveCell.Row
End Function

doesn't work because if I click away from the cell that uses the
function, the cell then gets the value of the active cell and not the
one in which the function is used. After much searching on MS and
Google, I admit that I'm stumped. :-|

Any ideas?

TIA
MArk




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Referencing "current" row (not using ActiveCell.Row)


"keepITcool" wrote in message
...
Function CallerAddr()
Application.Volatile
CallerAddr = Application.Caller.Address(external:=True)
End Function
Function CallerRow()
Application.Volatile
CallerRow = Application.Caller.Row
'This must be part of s'thing else
'=ROW() would be lots more efficient
End Function




Perfect! Thanks very much. :-)

Mark



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Mark" wrote:

This must be easy, but I'm being a bit stupid here as I can't find the
method that I'm after.

I have a custom volatile function that I want to return the row in
which the function is used - not the active row. (Actually, it does a
lot more, but this is the crux of the problem.)

So:

Function GetRow()
Application.Volatile (True)
GetRow = Application.ActiveCell.Row
End Function

doesn't work because if I click away from the cell that uses the
function, the cell then gets the value of the active cell and not the
one in which the function is used. After much searching on MS and
Google, I admit that I'm stumped. :-|

Any ideas?

TIA
MArk






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveCell.FormulaR1C1 = "=SUM(R[-tellerteller]C:R[-1]C)" Jack Sons Excel Discussion (Misc queries) 5 September 29th 09 09:58 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Functions for "current" & "previous" month to calculate data Priss Excel Worksheet Functions 11 April 15th 08 06:24 PM
=IF((TODAY()-B8)30, "Overdue", "Current"), Kev Excel Discussion (Misc queries) 3 December 16th 05 08:15 PM
XP VBA: Range("A2", ActiveCell.SpecialCells(xlLastCell)).Select wessman Excel Programming 2 July 23rd 03 06:33 PM


All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"