Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default Calling Cell (or ROW() and COLUMN() in VBA)

I am new to VBA and need what I would think would be something easy, but I
have not been able to work out how to do it.

I have a macro that sums all values from the cell the macro is in to some
limit. At present I need to enter "=ITEMSUM(ROW(),COLUMN())" in the cell.
So I know where I am being called from. What I want to be able to enter in
the cell is "=ITEMSUM()" and inside ItemSum get the equivalent of ROW() and
COLUMN(). How can I do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Calling Cell (or ROW() and COLUMN() in VBA)

I think this is what you are looking for.

Public Function Whatever() As String
'Application.volatile 'if you need it to recalc no matter what changes
With Application.Caller
Whatever = "Row " & .Row & " and column " & .Column
End With
End Function

insert this in a standard code module and call it from a cell. It will
return the row and column of the cell that it is in...
--
HTH...

Jim Thomlinson


"Scott" wrote:

I am new to VBA and need what I would think would be something easy, but I
have not been able to work out how to do it.

I have a macro that sums all values from the cell the macro is in to some
limit. At present I need to enter "=ITEMSUM(ROW(),COLUMN())" in the cell.
So I know where I am being called from. What I want to be able to enter in
the cell is "=ITEMSUM()" and inside ItemSum get the equivalent of ROW() and
COLUMN(). How can I do this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default Calling Cell (or ROW() and COLUMN() in VBA)

Thanks Jim. Application.Caller was exactly the thing I was hunting for

"Jim Thomlinson" wrote:

I think this is what you are looking for.

Public Function Whatever() As String
'Application.volatile 'if you need it to recalc no matter what changes
With Application.Caller
Whatever = "Row " & .Row & " and column " & .Column
End With
End Function

insert this in a standard code module and call it from a cell. It will
return the row and column of the cell that it is in...
--
HTH...

Jim Thomlinson


"Scott" wrote:

I am new to VBA and need what I would think would be something easy, but I
have not been able to work out how to do it.

I have a macro that sums all values from the cell the macro is in to some
limit. At present I need to enter "=ITEMSUM(ROW(),COLUMN())" in the cell.
So I know where I am being called from. What I want to be able to enter in
the cell is "=ITEMSUM()" and inside ItemSum get the equivalent of ROW() and
COLUMN(). How can I do this?

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
Calling Column D Trackeous Excel Discussion (Misc queries) 1 December 1st 06 02:42 AM
Calling Column D Trackeous Excel Discussion (Misc queries) 0 November 30th 06 03:42 PM
Calling Column D Stefi Excel Discussion (Misc queries) 0 November 30th 06 02:31 PM
Calling Column D Trackeous Excel Discussion (Misc queries) 0 November 30th 06 02:17 PM
Calling Column D Stefi Excel Discussion (Misc queries) 0 November 30th 06 08:59 AM


All times are GMT +1. The time now is 11:03 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"