ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range("A1:A10").Interior.ColorIndex = Xlnone (https://www.excelbanter.com/excel-programming/412820-range-a1-a10-interior-colorindex-%3D-xlnone.html)

michdenis

Range("A1:A10").Interior.ColorIndex = Xlnone
 
Hi,

I may write this :

Range("A1:A10").Interior.ColorIndex = 0

But i could write this too ...
'---------------------
Dim x As Excel.Constants
x = xlNone
Range("A1:A10").Interior.ColorIndex = x
'---------------------

The value of Xlnone = -4142

Any explanations why both methods work ?

Thank for your collaboration and help.

Bob Phillips[_3_]

Range("A1:A10").Interior.ColorIndex = Xlnone
 
Because 0 is white. It removes the border though.

--
__________________________________
HTH

Bob

"MichDenis" wrote in message
...
Hi,

I may write this :

Range("A1:A10").Interior.ColorIndex = 0

But i could write this too ...
'---------------------
Dim x As Excel.Constants
x = xlNone
Range("A1:A10").Interior.ColorIndex = x
'---------------------

The value of Xlnone = -4142

Any explanations why both methods work ?

Thank for your collaboration and help.




michdenis

Range("A1:A10").Interior.ColorIndex = Xlnone
 

| Because 0 is white. It removes the border though.

Not on my computer...

Try this :
'-----------------------
Sub test()
Range("A1:A10").Interior.ColorIndex = 0
MsgBox Range("A1").Interior.ColorIndex
End Sub
'-----------------------
Or this,
'-----------------------
Sub test1()
Range("A1:A10").Interior.ColorIndex = xknone
MsgBox Range("A1").Interior.ColorIndex
End Sub
'-----------------------

The message is the same : Message = -4142

Thank for your collaboration.

ward376

Range("A1:A10").Interior.ColorIndex = Xlnone
 
0 is none, 2 is white.

Cliff Edwards

FSt1

Range("A1:A10").Interior.ColorIndex = Xlnone
 
hi
i think your are a little hung up on thinking that this should be a black
and white issue. not.
see this site.
http://www.mvps.org/dmcritchie/excel/colors.htm
there is no color 0(zero)
there is no color xlnone.
xlnone means(in some cases) revert to defaults. but it is applied to more
that color and interiors.
Range("A1:A10").Font.ColorIndex = xlnone
your msgbox will now say 4.
Range("A1:A10").Linestyle = xlnone
Range("A1").pastespecial Paste:=xlPasteAll, operation = xlnone
and it goes on and on.
understand that many things have more than one word or meaning.
some people call it a pier.
some people call it a warf.
why do we have two words for the same thing?
it is not much different in programming.
why does xlnone have so many meanings?
who know?
the important thing is to learn how to use it in all of its different
meanings.
my thoughts

regards
FSt1


"MichDenis" wrote:


| Because 0 is white. It removes the border though.

Not on my computer...

Try this :
'-----------------------
Sub test()
Range("A1:A10").Interior.ColorIndex = 0
MsgBox Range("A1").Interior.ColorIndex
End Sub
'-----------------------
Or this,
'-----------------------
Sub test1()
Range("A1:A10").Interior.ColorIndex = xknone
MsgBox Range("A1").Interior.ColorIndex
End Sub
'-----------------------

The message is the same : Message = -4142

Thank for your collaboration


FSt1

Range("A1:A10").Interior.ColorIndex = Xlnone
 
hi
you caught me. usually i test before posting. today i was shooting from the
hip and screwed up some syntax. no problem. the main point i was trying to
make is that in programming there is usually more than one way to do
something. so we should not get hung up on two different ways to do something
just learn to use it the best way we know how and knowing more than one way
comes in handy sometimes.

my thoughts
Regards
FSt1


"MichDenis" wrote:

A ) Not working ...
| Range("A1:A10").Font.ColorIndex = xlnone

You mean :
Range("A1:A10").Font.ColorIndex = Xlautomatic ( -4105)

B ) Not working either
| Range("A1:A10").Linestyle = xlnone

You mean something like this :
Range("A1:A10").Borders(xlEdgeTop).LineStyle = xlNone

|C ) Range("A1").pastespecial Paste:=xlPasteAll, operation = xlnone
You mean :
Range("A1").PasteSpecial Paste:=xlPasteAll, operation:=xlNone

*** First 2 examples, we could use "xlnone" or "0", the result is the same.
The last exemple works only with xlnone

No problem using xlnone (meaning absence of ...) in different situations...

it's was a question of curiosity
Xlnone has a value of -4142 ...why could we also use 0 to obtain the same result ?

| the important thing is to learn how to use it in all of its different
***Probably right. I'm not a machine and from time to time, i like to wonder about thing !


Thank for your thoughts


Salutations.


"FSt1" a écrit dans le message de news: ...
hi
i think your are a little hung up on thinking that this should be a black
and white issue. not.
see this site.
http://www.mvps.org/dmcritchie/excel/colors.htm
there is no color 0(zero)
there is no color xlnone.
xlnone means(in some cases) revert to defaults. but it is applied to more
that color and interiors.
Range("A1:A10").Font.ColorIndex = xlnone
your msgbox will now say 4.
Range("A1:A10").Linestyle = xlnone
Range("A1").pastespecial Paste:=xlPasteAll, operation = xlnone
and it goes on and on.
understand that many things have more than one word or meaning.
some people call it a pier.
some people call it a warf.
why do we have two words for the same thing?
it is not much different in programming.
why does xlnone have so many meanings?
who know?
the important thing is to learn how to use it in all of its different
meanings.
my thoughts

regards
FSt1


"MichDenis" wrote:


| Because 0 is white. It removes the border though.

Not on my computer...

Try this :
'-----------------------
Sub test()
Range("A1:A10").Interior.ColorIndex = 0
MsgBox Range("A1").Interior.ColorIndex
End Sub
'-----------------------
Or this,
'-----------------------
Sub test1()
Range("A1:A10").Interior.ColorIndex = xknone
MsgBox Range("A1").Interior.ColorIndex
End Sub
'-----------------------

The message is the same : Message = -4142

Thank for your collaboration



All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com