I think you are simply missing the the Word Set before each object.
Set is used when you want a variable equivalent to an object. without
set it is simply setting your variable to the value (not object) of the
object and not the object itself.
from
r = oSh.Range("MyRange")
r = oSh.Range("MyRange[#Data]")
r = oSh.Range("MyRange[ rowvariable, [ColumnName]]")
to
set r = oSh.Range("MyRange")
set r = oSh.Range("MyRange[#Data]")
set r = oSh.Range("MyRange[ rowvariable, [ColumnName]]")
You code is simply returning the value from each of the loctions. The
word Set says your variable r is equivalent to the object on the right
side of the equal sign.
--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=186096
Excel Live Chat