Range.BorderAround(xlLineStyleNone)

  • Thread starter Thread starter John A Grandy
  • Start date Start date
J

John A Grandy

for me, the following code does not remove any borders for any cells in the
range .....

For Each rCell In rTarget
Call rCell.BorderAround(xlLineStyleNone)
Next rCell

according to the xl2000 docs, this should work ...
 
Wat is the Call statement for? Why don't you use a With statement for a
defined range?
Richard Choate

for me, the following code does not remove any borders for any cells in the
range .....

For Each rCell In rTarget
Call rCell.BorderAround(xlLineStyleNone)
Next rCell

according to the xl2000 docs, this should work ...
 
Hi John,

This should work better:

rTarget.Borders.LineStyle = xlLineStyleNone

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 
Huh? What does that have to do with anything?

The "With" statement has absolutely no affect on the functionality of the
methods invoked on its operand (or sub-classes of its operand) ...

.... it's just a presentational shorthand which can be used for those a
stylistic prefererence for coding in that manner ....

in fact in this particular case, using a "With" has no value whatsoever
because only one method is invoked for each iteration of the "For Each" loop
 
I was referring to using a With statement for getting rid of the borders in
a range without looping through them. If you feel you know more than I do
and that my recommendations are stupid or uninformed, just do something
else. I'm sorry if you feel I've given you unsatisfactory help and I won't
bother you with any more of my attempts to help you.
Richard Choate

Huh? What does that have to do with anything?

The "With" statement has absolutely no affect on the functionality of the
methods invoked on its operand (or sub-classes of its operand) ...

.... it's just a presentational shorthand which can be used for those a
stylistic prefererence for coding in that manner ....

in fact in this particular case, using a "With" has no value whatsoever
because only one method is invoked for each iteration of the "For Each" loop
 
Your statements re With/End With being useless may be true for this particular code, but in
general this syntax can improve the execution speed. MS has published data describing how much
improvement you get for each "dot" that you remove.
 
My interpretation of his post was that he was going through a range clearing
the borders from cells. My solution, without giving the specific code just
yet, was to just do it all at once without looping at all. I don't see why
that is so useless without knowing more, but the OP seemed offended that I
had wasted his time with such a suggestion and proceeded to give me a
lesson. I'm trying to help and I don't need a sanctimonious OP implying that
my help was stupid. I've been coding for a few years now and feel that I
have some idea of what I'm doing, otherwise I would not have responded,
potentially setting an OP in the wrong direction. Thank you, Myrna, for your
polite support of my attempt to help.
Richard Choate

Your statements re With/End With being useless may be true for this
particular code, but in
general this syntax can improve the execution speed. MS has published data
describing how much
improvement you get for each "dot" that you remove.
 
Richard, I wasn't offended and I wasn't implying you are stupid.

That's the problem with newsgroups (and especially e-mail) .... it's very
tough to interpret tone.

Imagine you're in a meeting and someone says "Huh? What does that have to do
with anything?" .... their tone & facial expressions, etc. could mean you
interpret that remark a dozen different ways.
 
Thanks for your comments. You are absolutely right about the tone thing. I
was communicating frequently with a potential client who writes extremely
short messages, sometimes only one word, and signs her name with an initial.
It is really easy to interpret that as curt and harsh, and it can become
that way when both parties adopt that technique. It is truly difficult to
interpret tone and I'm sorry for jumping on you prematurely.
Richard

Richard, I wasn't offended and I wasn't implying you are stupid.

That's the problem with newsgroups (and especially e-mail) .... it's very
tough to interpret tone.

Imagine you're in a meeting and someone says "Huh? What does that have to do
with anything?" .... their tone & facial expressions, etc. could mean you
interpret that remark a dozen different ways.
 
Back
Top