Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel 2003 macro that use acrobat Elements | Setting up and Configuration of Excel | |||
Referencing a named range based upon Range name entry in cell | Excel Worksheet Functions | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Selecting a Range inside a range | Excel Programming | |||
Check if a range is inside another | Excel Programming |