View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default custom function - with built-in function

in VBA

Dim rng as Range
Dim v as Variant
set rng = Range("B9")
v = Range("B9").Value

rng is a reference to the cell B9
v is a variable containing the value stored in B9.

If a function returns a reference to the cell, then it is designed to be
utilized by another function which requires a reference. if used alone,
then it is similar to using the default value of a range (which is its
value).

--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:sx6Jd.22946$EG1.22013@lakeread04...
"functions like index and offset will return a reference,
but the lookup functions return a value."

Usage of the above has always confused me.
Clearly tell me the difference in "reference" and "value".
All I can presently say is that reference might be "B4",
whereby the value in B4 might be "100" or "testing".
I'm a bit more confused with the reference-side.
TIA,



"keepITcool" wrote in message
ft.com...


functions like index and offset will return a reference,
but the lookup functions return a value.

so:
either reconstruct your lookup with match and index.
or:
create a new function (with more arguments)
that incorporates the vlookup inside VBA


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


VilMarci wrote :

Hi,

I have a small excel function that returns the background color value
of a cell:

Function ColorOfCell(cellaneve As Range)

Dim CellColor As Integer

CellColor = cellaneve.Interior.ColorIndex
ColorOfCell = CellColor

End Function

That's ok. Works from excel like =ColorOfCell(A1)
But how can I make it work to use with built-in functions?

Like:
=ColorOfCell(HLOOKUP($A$1;Personal!$B$20:$Q$51;J6; FALSE))

Is there any general solution to do this?

Marton