Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Macro user defined function row information

I am writing a long macro User defined function which will be used in
multiple workbooks. it uses multiple inputs from the workbooks all of which
will be in the same row. I have been using the =XXX(a,b,c,d,e,f,g,...) but
would prefer no or just one transfer variable. The columns may change but I
have a method of determining which column I need. My question is "How do I,
either determine which row The particular UDF is in, or call for a value x
number of columns from the cell but in the same row?" (I know I could just
insert a column with "=ROW()" and reference it <and have done so in the past
but would like a better method
[I am using EXCEL 2002]
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro user defined function row information

set rng = Application.Caller
set rng1 = rng.parent.Cells(rng.row,"F")

--
Regards,
Tom Ogilvy


"bj" wrote in message
...
I am writing a long macro User defined function which will be used in
multiple workbooks. it uses multiple inputs from the workbooks all of

which
will be in the same row. I have been using the =XXX(a,b,c,d,e,f,g,...)

but
would prefer no or just one transfer variable. The columns may change but

I
have a method of determining which column I need. My question is "How do

I,
either determine which row The particular UDF is in, or call for a value x
number of columns from the cell but in the same row?" (I know I could just
insert a column with "=ROW()" and reference it <and have done so in the

past
but would like a better method
[I am using EXCEL 2002]



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Macro user defined function row information

You should always include all input in the argument list, otherwise Excel
doesn't know when to recalculate. But it can be a range instead of single
cells. In the function you'll then have to pick the right cells from the
range argument.

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"bj" wrote in message
...
I am writing a long macro User defined function which will be used in
multiple workbooks. it uses multiple inputs from the workbooks all of
which
will be in the same row. I have been using the =XXX(a,b,c,d,e,f,g,...)
but
would prefer no or just one transfer variable. The columns may change but
I
have a method of determining which column I need. My question is "How do
I,
either determine which row The particular UDF is in, or call for a value x
number of columns from the cell but in the same row?" (I know I could just
insert a column with "=ROW()" and reference it <and have done so in the
past
but would like a better method
[I am using EXCEL 2002]



  #4   Report Post  
Posted to microsoft.public.excel.programming
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Macro user defined function row information

Thank you exactly what I needed.

"Tom Ogilvy" wrote:

set rng = Application.Caller
set rng1 = rng.parent.Cells(rng.row,"F")

--
Regards,
Tom Ogilvy


"bj" wrote in message
...
I am writing a long macro User defined function which will be used in
multiple workbooks. it uses multiple inputs from the workbooks all of

which
will be in the same row. I have been using the =XXX(a,b,c,d,e,f,g,...)

but
would prefer no or just one transfer variable. The columns may change but

I
have a method of determining which column I need. My question is "How do

I,
either determine which row The particular UDF is in, or call for a value x
number of columns from the cell but in the same row?" (I know I could just
insert a column with "=ROW()" and reference it <and have done so in the

past
but would like a better method
[I am using EXCEL 2002]




  #5   Report Post  
Posted to microsoft.public.excel.programming
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Macro user defined function row information

In the particular case where this UDF will be used, no recalcs should ever be
needed. The spreadsheet is generated elsewhere, and the format is for their
convienience. The appropriate columns are not adjacent, and the prefered
place to put the column using this function is in the middle of the lookup
columns. There are other users who want the columns kept in the order they
they come in. If anyone changes any data a new spreadsheet will be provided,
I agree with you for general situations.

"Niek Otten" wrote:

You should always include all input in the argument list, otherwise Excel
doesn't know when to recalculate. But it can be a range instead of single
cells. In the function you'll then have to pick the right cells from the
range argument.

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"bj" wrote in message
...
I am writing a long macro User defined function which will be used in
multiple workbooks. it uses multiple inputs from the workbooks all of
which
will be in the same row. I have been using the =XXX(a,b,c,d,e,f,g,...)
but
would prefer no or just one transfer variable. The columns may change but
I
have a method of determining which column I need. My question is "How do
I,
either determine which row The particular UDF is in, or call for a value x
number of columns from the cell but in the same row?" (I know I could just
insert a column with "=ROW()" and reference it <and have done so in the
past
but would like a better method
[I am using EXCEL 2002]




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
user defined function help Floyd Steele Excel Worksheet Functions 1 February 2nd 06 10:47 PM
User Defined Function used in Macro returns #VALUE hodler Excel Programming 1 July 30th 04 03:46 AM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
User defined function Carlos Paez Excel Programming 1 June 24th 04 02:18 AM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


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