Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default 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.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default Range("A1:A10").Interior.ColorIndex = Xlnone

0 is none, 2 is white.

Cliff Edwards
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Range("A1").Interior.ColorIndex=xyz does not work iwl Excel Programming 1 December 7th 07 04:30 PM
"Error 1004 Unable to set the ColorIndex property of the Interior. Bob Barnes Excel Programming 3 April 30th 07 06:42 PM
"COUNTIF" using ".ColorIndex" and "AND" styne666 Excel Programming 2 February 6th 07 04:35 PM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM
colorindex = xlnone on condition of month of year Jane Excel Programming 8 August 8th 05 12:44 AM


All times are GMT +1. The time now is 02:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"