Why does this work... ... but not this?

M

Marcus Ostman

Why does this work...

=WORK("A1")

Function WORK(Cell)
RNG = Range(Cell).Value
MsgBox RNG
End Function

.... but not this?

=WORK(A1)

Function WORK(Cell as Range)
RNG = Range(Cell).Value
MsgBox RNG
End Function

/Marcus
 
E

Eddy

Marcus
In your second example, you have already defined Cell as a range object.
Therefore, you don't need to put the "Cell" (the range object) into another
range object. The following should work:-

RNG = Cell.Value
 
Top