Selection.Cells vs Range reference - strange behaviour (using

Selection.Cells vs Range reference - strange behaviour (using

Post by VGFyYSB » Wed, 22 Aug 2007 17:40:03


Hi Bob,

Thanks - your first example was exactly what I needed! Coming from a Java
background that seems strange to me - simply removing the brackets from
around 'Range("C1").Cells' to make it work.

Would you mind giving me a quick explanation of what's going on there so I
know for next time?

Many Thanks,
Tara H
 
 
 

Selection.Cells vs Range reference - strange behaviour (using

Post by Bob Philli » Wed, 22 Aug 2007 19:18:37

s I said, I had to make assumptions as I don't know what format_over_105
does, but it would seem that it expects a cell(s) reference.
Range("C1").Cells is such, but by enclosing it within parentheses, the
expression was being evaluated before being passed to the routine, hence it
was a value being passed, not the cell(s) reference. The brackets have a
purpose in a call statement, they are not just ways to organise the
statements.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Tara H" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...



 
 
 

Selection.Cells vs Range reference - strange behaviour (using

Post by VGFyYSB » Wed, 22 Aug 2007 19:40:01

hanks Bob.

I included the format_over_105 code in my original post - it expects a
Range, but as I said, my background is in Java, so I am used to putting
parentheses to indicate the parameters to be passed.

I'll bear this in mind for the future. Many thanks again for your help.

Tara H

"Bob Phillips" wrote:

 
 
 

Selection.Cells vs Range reference - strange behaviour (using

Post by Bob Philli » Wed, 22 Aug 2007 21:07:17

ara,

The one I forgot to mention which may be more familiar to you is to call the
procedure, then you use parentheses

Call format_over_105(Range("C1").Cells)


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Tara H" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...


 
 
 

Selection.Cells vs Range reference - strange behaviour (using

Post by VGFyYSB » Wed, 22 Aug 2007 21:20:01

h, I see! I'll have to make a note of all this - I've only recently had to
use subs that take parameters, but I'm sure I'll need to refer to this again
and again.

Thanks,
Tara

P.S. Sorry I forgot earlier to mark the answer!

"Bob Phillips" wrote:

 
 
 

Selection.Cells vs Range reference - strange behaviour (using

Post by Bob Philli » Thu, 23 Aug 2007 01:20:52

hese questions end up in the public newsgroups, which is where I lurk, and
the ratings are meaningless here, we neither see them, nor care about them.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Tara H" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...