Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 331
Default referencing range elements inside the macro

Hi,

I am creating a UD function of the following form Function interpolate(z,
inputX as Range , inputY as Range)

In the body of the function, I need to cross-reference elements of inputX
with inputY ranges.

If it were a spreadsheet, I could use lookups, offset, match, index
functions. I am not really sure how to do this in VBA inside the function.

Can someone please illustrate this with a few examples of sample code?

For example, I need to find an element in inputY with a position
corresponding to inputX and perform some math on it. So, if 17 is in the
third position in inputX , I want to get a corresponding inputY element.


Hope it is not overly confusing.

Thank you for your help.


--
______
Regards,
Greg
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default referencing range elements inside the macro

Function interpolate(z, inputX as Range , inputY as Range)

dim i as long
'should check here that ranges are the same size

for i = 1 to inputX.cells.count

'here you can work with
'inputX.cells(i)
'inputY.cells(i)

next i

etc....



--
Tim Williams
Palo Alto, CA


"Greg" wrote in message
...
Hi,

I am creating a UD function of the following form Function interpolate(z,
inputX as Range , inputY as Range)

In the body of the function, I need to cross-reference elements of inputX
with inputY ranges.

If it were a spreadsheet, I could use lookups, offset, match, index
functions. I am not really sure how to do this in VBA inside the

function.

Can someone please illustrate this with a few examples of sample code?

For example, I need to find an element in inputY with a position
corresponding to inputX and perform some math on it. So, if 17 is in

the
third position in inputX , I want to get a corresponding inputY element.


Hope it is not overly confusing.

Thank you for your help.


--
______
Regards,
Greg



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
excel 2003 macro that use acrobat Elements Renato Setting up and Configuration of Excel 1 December 3rd 07 11:16 AM
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Selecting a Range inside a range hcova Excel Programming 0 July 13th 04 03:26 PM
Check if a range is inside another Rafael Sobral Excel Programming 2 January 28th 04 06:10 PM


All times are GMT +1. The time now is 04:27 AM.

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"