View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Not at all clear on use of variables and/or object variables

A varaible and an object are both things that you store in memory in order to
reference them. That is really where the similarity ends.

Lets start with a variable. A variable is one of your fundamental data
types. It is an integer, long, double, string, boolean, array or... They are
a variables of a specific memory size. You store values in the varaibles and
youi can read the values back. You can write to a varaible with an equal sign.

Objects are much more complex. Without getting too far into object oriented
programming objects are tangable things like workbooks, worksheets or ranges.
Each different object has it's own properties and methods. Properties
describe the object such as the cells value, colour, border, ... Methods are
things that the object can do such as sort, copy, calculate, ... When you
want to create or modify an object you need to use the set key word. Objects
use up a fair bit more memory than a standard variable but then again they
can do a lot more stuff. While they do take up a lot more memory they are
still very efficient to pass around as you are really only passing a pointer
to the object and not the entire object itself.
--
HTH...

Jim Thomlinson


"JMay-Rke" wrote:

I jumped on the Excel (VBA) bandwagon some years ago. I have
dozens of books and reference them constantly. In no book or
in my visiting any newsgroup have I been able to clearly make
the distinction between when to engage a regular variable versus
an object variable - particularly as regards the Range object.

Can someone make an attempt to CONTRAST these two elements?