Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Determine the current cell while inside a User Defined Function

I have a worksheet that contains User Defined Function calls in the
cells. At the time you open the sheet, the function is called and
populates the value for the cell. I am trying to determine the current
cell. When I walk through this in debug mode, it says the active column
is the last column that was active when the sheet was saved. It doesn't
refer to the current cell that has called the user defined function.
How can I determine what the cell that the user defined function is
currently updating?

My cell contains the following function:
=wbGetLastCompletedSampleDate("123","abc",QueryDat es!B8,QueryDates!B9)
When it runs the function, I need to set 2 custom document properties
for the cell that contain QueryDates!B8 & QeuryDates!B9. Whenever I
look at the activecell within the function WbGetLastCompletedSampleDate
(in runtime) it always returns the same value.

I appreciate any feedback on this issue.

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Determine the current cell while inside a User Defined Function

Application.caller
is what you're looking for.

Option Explicit
Function myFunc() As String
With Application.Caller
myFunc = .Row & "--" & .Column
End With
End Function

pmax wrote:

I have a worksheet that contains User Defined Function calls in the
cells. At the time you open the sheet, the function is called and
populates the value for the cell. I am trying to determine the current
cell. When I walk through this in debug mode, it says the active column
is the last column that was active when the sheet was saved. It doesn't
refer to the current cell that has called the user defined function.
How can I determine what the cell that the user defined function is
currently updating?

My cell contains the following function:
=wbGetLastCompletedSampleDate("123","abc",QueryDat es!B8,QueryDates!B9)
When it runs the function, I need to set 2 custom document properties
for the cell that contain QueryDates!B8 & QeuryDates!B9. Whenever I
look at the activecell within the function WbGetLastCompletedSampleDate
(in runtime) it always returns the same value.

I appreciate any feedback on this issue.

Thanks.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Determine the current cell while inside a User Defined Function

Thank YOU! I searched help and looked at my books, but didn't find
that. I appreciate your help.

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
Can I Assign A User Defined Function To A Cell? smartin Excel Worksheet Functions 0 June 28th 09 10:25 PM
Color a result cell in a user defined function aaa Excel Discussion (Misc queries) 1 May 8th 06 04:16 PM
User defined function to count pay days in current month. dbmathis Excel Programming 4 August 29th 05 01:43 AM
current row of user-defined function? usenethelp Excel Programming 5 July 22nd 04 04:53 AM
current cell in user-defined function Julio Kuplinsky Excel Programming 3 December 8th 03 06:24 PM


All times are GMT +1. The time now is 04:59 PM.

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

About Us

"It's about Microsoft Excel"