PC Review


Reply
Thread Tools Rate Thread

Capture cell address in UDF

 
 
Jan Kronsell
Guest
Posts: n/a
 
      21st Apr 2007
Hi NG!

Is there a way of capturing the cell address of an argument in a UDF in
stead of the value of the argument.

I have a UDF definition like

Function Test(arg)
....
End Function

when I use the function I type =test(A1) and i get the value of A1. But
what I like to captuire is the address A1

Is there any way to achieve this?

Jan


 
Reply With Quote
 
 
 
 
Mike Fogleman
Guest
Posts: n/a
 
      21st Apr 2007
Function Test(arg As Range)
Test = arg.Address
End Function

Mike F

"Jan Kronsell" <kronsell(nomorespam)@adslhome.dk> wrote in message
news:%(E-Mail Removed)...
> Hi NG!
>
> Is there a way of capturing the cell address of an argument in a UDF in
> stead of the value of the argument.
>
> I have a UDF definition like
>
> Function Test(arg)
> ...
> End Function
>
> when I use the function I type =test(A1) and i get the value of A1. But
> what I like to captuire is the address A1
>
> Is there any way to achieve this?
>
> Jan
>



 
Reply With Quote
 
=?Utf-8?B?TWlrZQ==?=
Guest
Posts: n/a
 
      21st Apr 2007

Put this into its own module
Function CPosition() As String
'Runs from sheet1 to trigger event
'To get it to work, enter this into the desired cell:
'=CPos()
Application.Volatile
CPosition = "Cursor is in " & ActiveCell.Address(False, False)
End Function

And put this into sheet1 module
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Worksheets("Sheet1").Range("A1").Formula = CPosition()

Me.Calculate
End Sub

"Jan Kronsell" wrote:

> Hi NG!
>
> Is there a way of capturing the cell address of an argument in a UDF in
> stead of the value of the argument.
>
> I have a UDF definition like
>
> Function Test(arg)
> ....
> End Function
>
> when I use the function I type =test(A1) and i get the value of A1. But
> what I like to captuire is the address A1
>
> Is there any way to achieve this?
>
> Jan
>
>
>

 
Reply With Quote
 
Jan Kronsell
Guest
Posts: n/a
 
      23rd Apr 2007
Thank you, but I need a fucntion not a Sub.

Jan

"Mike" <(E-Mail Removed)> skrev i en meddelelse
news:C28C9545-1CF5-4CCD-B2DA-(E-Mail Removed)...
>
> Put this into its own module
> Function CPosition() As String
> 'Runs from sheet1 to trigger event
> 'To get it to work, enter this into the desired cell:
> '=CPos()
> Application.Volatile
> CPosition = "Cursor is in " & ActiveCell.Address(False, False)
> End Function
>
> And put this into sheet1 module
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
>
> Worksheets("Sheet1").Range("A1").Formula = CPosition()
>
> Me.Calculate
> End Sub
>
> "Jan Kronsell" wrote:
>
>> Hi NG!
>>
>> Is there a way of capturing the cell address of an argument in a UDF in
>> stead of the value of the argument.
>>
>> I have a UDF definition like
>>
>> Function Test(arg)
>> ....
>> End Function
>>
>> when I use the function I type =test(A1) and i get the value of A1. But
>> what I like to captuire is the address A1
>>
>> Is there any way to achieve this?
>>
>> Jan
>>
>>
>>



 
Reply With Quote
 
Jan Kronsell
Guest
Posts: n/a
 
      23rd Apr 2007
Thank you. It works great.

Jan

"Mike Fogleman" <(E-Mail Removed)> skrev i en meddelelse
news:(E-Mail Removed)...
> Function Test(arg As Range)
> Test = arg.Address
> End Function
>
> Mike F
>
> "Jan Kronsell" <kronsell(nomorespam)@adslhome.dk> wrote in message
> news:%(E-Mail Removed)...
>> Hi NG!
>>
>> Is there a way of capturing the cell address of an argument in a UDF in
>> stead of the value of the argument.
>>
>> I have a UDF definition like
>>
>> Function Test(arg)
>> ...
>> End Function
>>
>> when I use the function I type =test(A1) and i get the value of A1. But
>> what I like to captuire is the address A1
>>
>> Is there any way to achieve this?
>>
>> Jan
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
outlook add-in, add-in for outlook, outlook contact capture, capturecontacts into outlook, outlook add-on, address capture, capture name,addresses, import contacts to Outlook, transfer contact details into outlook Dhan Microsoft Outlook Program Addins 0 24th Apr 2010 09:03 AM
can you capture info from a cell without retyping in another cell jallen449 Microsoft Word Document Management 1 12th Mar 2010 07:04 PM
How to capture current cell address in a datagrid =?Utf-8?B?R2lyaQ==?= Microsoft Dot NET Framework Forms 4 11th May 2004 12:11 PM
Capture URL in IE address bar with C# michael_hk Microsoft C# .NET 2 25th Mar 2004 01:15 PM
Formula to capture cell location as opposed to cell contents Dan Microsoft Excel Worksheet Functions 0 10th Oct 2003 04:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:54 PM.