Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Color index values

Hi,

In VB I want to use the fill color option based on certain conditions.

I know that yellow has a color index value 6.

I want to know where I can find a glossary for all the color index values.

Please tell me the source for the same. I searched in MS VB help but couldnt
find the same.

Regards,
Hari
India





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Color index values

Hari

Run this code on an empty worksheet.

Sub CheckColorIndex()
'by Wilson -- creates colour chart on worksheet
Dim CurrVal As Integer
Dim ColorChart As Range
Dim cell As Range
Set ColorChart = Range("A1:G8")
CurrVal = 1
For Each cell In ColorChart
With cell
..Value = CurrVal
..Font.Size = 14
..Font.Bold = True
..Font.ColorIndex = 2
..Interior.ColorIndex = cell.Value
..Interior.Pattern = xlSolid
CurrVal = CurrVal + 1
End With
Next cell
End Sub

--
XL2002
Regards

William



"Hari" wrote in message
...
| Hi,
|
| In VB I want to use the fill color option based on certain conditions.
|
| I know that yellow has a color index value 6.
|
| I want to know where I can find a glossary for all the color index values.
|
| Please tell me the source for the same. I searched in MS VB help but
couldnt
| find the same.
|
| Regards,
| Hari
| India
|
|
|
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Color index values

Hi Hari

See if David McRitchie's
http://www.mvps.org/dmcritchie/excel/colors.htm
is of help. And this little macro:


Sub Colors()
Dim L As Long
For L = 1 To 56
Cells(L, 1).Interior.ColorIndex = L
Cells(L, 2).Font.ColorIndex = L
Cells(L, 2).Value = "Colorindex " & L
Cells(L, 3).Value = "Colorindex " & L
Next
End Sub

HTH. Best wishes Harald

"Hari" skrev i melding
...
Hi,

In VB I want to use the fill color option based on certain conditions.

I know that yellow has a color index value 6.

I want to know where I can find a glossary for all the color index values.

Please tell me the source for the same. I searched in MS VB help but

couldnt
find the same.

Regards,
Hari
India







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Color index values

Lockup ColorIndex property in VBA Help.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Hari" wrote in message
...
Hi,

In VB I want to use the fill color option based on certain conditions.

I know that yellow has a color index value 6.

I want to know where I can find a glossary for all the color index values.

Please tell me the source for the same. I searched in MS VB help but

couldnt
find the same.

Regards,
Hari
India







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Color index values

Hari,

You can run this in an empty worksheet:

Sub test()

Dim i As Double

i = 0
On Error Resume Next
ActiveSheet.Cells.Clear

While Err = 0
i = i + 1
ActiveSheet.Cells(i, 1) = i
ActiveSheet.Cells(i, 2).Interior.ColorIndex = i
Wend

ActiveSheet.Cells(i, 1).Clear

End Sub

hth,

Doug Glancy

"Hari" wrote in message
...
Hi,

In VB I want to use the fill color option based on certain conditions.

I know that yellow has a color index value 6.

I want to know where I can find a glossary for all the color index values.

Please tell me the source for the same. I searched in MS VB help but

couldnt
find the same.

Regards,
Hari
India









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Color index values

I prefer

For x = 1 To 56
Cells(x, 1).Interior.ColorIndex = x
Next x

- Piku

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Color index values

Sure. Until I wrote it I didn't know how many colors there were. Plus, I
didn't know if there were more colors in later versions than my xl2000.

Doug

"pikus " wrote in message
...
I prefer

For x = 1 To 56
Cells(x, 1).Interior.ColorIndex = x
Next x

- Pikus


---
Message posted from http://www.ExcelForum.com/



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Color index values

Hi Doug,
If that is a question, 56 colors in the palette in all current versions of Excel.

As far as the future goes use Dimension as long instead of integer,
then if Excel is changed you'll be in better shape.

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm


"Doug Glancy" wrote ...
Sure. Until I wrote it I didn't know how many colors there were. Plus, I
didn't know if there were more colors in later versions than my xl2000.

Doug

"pikus " wrote in message
...
I prefer

For x = 1 To 56
Cells(x, 1).Interior.ColorIndex = x
Next x

- Pikus


---
Message posted from http://www.ExcelForum.com/





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Color index values

Could you expand on the Dimension comment? I actually Dimensioned as a
Double, not Integer, although normally I would have done a Long, but I
thought I read a post somewhere that Double was more efficient since it was
native.

As Pikus said earlier today "learn the basics and then you won't be
confused."

!

Doug

"David McRitchie" wrote in message
...
Hi Doug,
If that is a question, 56 colors in the palette in all current versions of

Excel.

As far as the future goes use Dimension as long instead of integer,
then if Excel is changed you'll be in better shape.

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm


"Doug Glancy" wrote ...
Sure. Until I wrote it I didn't know how many colors there were. Plus,

I
didn't know if there were more colors in later versions than my xl2000.

Doug

"pikus " wrote in message
...
I prefer

For x = 1 To 56
Cells(x, 1).Interior.ColorIndex = x
Next x

- Pikus


---
Message posted from http://www.ExcelForum.com/







  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Color index values

Hi Doug,
This should look familiar:
It would be looking for a whole number not something with a decimal
fraction. And long works faster than 2 byte integer anyway -- at least
that's what I think I've read in the newsgroups.

Long Data Type
Long (long integer) variables are stored as signed 32-bit (4-byte)
numbers ranging in value from -2,147,483,648 to 2,147,483,647.
The type-declaration character for Long is the ampersand (&).


Double Data Type
Double (double-precision floating-point) variables are stored as
IEEE 64-bit (8-byte) floating-point numbers ranging in value
from -1.79769313486231E308 to -4.94065645841247E-324
for negative values and from 4.94065645841247E-324 to
1.79769313486232E308 for positive values.
The type-declaration character for Double is the number sign (#).
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Doug Glancy" wrote in message ...
Could you expand on the Dimension comment? I actually Dimensioned as a
Double, not Integer, although normally I would have done a Long, but I
thought I read a post somewhere that Double was more efficient since it was
native.

As Pikus said earlier today "learn the basics and then you won't be
confused."

!

Doug

"David McRitchie" wrote in message
...
Hi Doug,
If that is a question, 56 colors in the palette in all current versions of

Excel.

As far as the future goes use Dimension as long instead of integer,
then if Excel is changed you'll be in better shape.

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm


"Doug Glancy" wrote ...
Sure. Until I wrote it I didn't know how many colors there were. Plus,

I
didn't know if there were more colors in later versions than my xl2000.

Doug

"pikus " wrote in message
...
I prefer

For x = 1 To 56
Cells(x, 1).Interior.ColorIndex = x
Next x

- Pikus


---
Message posted from http://www.ExcelForum.com/











  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Color index values

David,

Thanks. I'm a little less confused now!

Doug

"David McRitchie" wrote in message
...
Hi Doug,
This should look familiar:
It would be looking for a whole number not something with a decimal
fraction. And long works faster than 2 byte integer anyway -- at

least
that's what I think I've read in the newsgroups.

Long Data Type
Long (long integer) variables are stored as signed 32-bit (4-byte)
numbers ranging in value from -2,147,483,648 to 2,147,483,647.
The type-declaration character for Long is the ampersand (&).


Double Data Type
Double (double-precision floating-point) variables are stored as
IEEE 64-bit (8-byte) floating-point numbers ranging in value
from -1.79769313486231E308 to -4.94065645841247E-324
for negative values and from 4.94065645841247E-324 to
1.79769313486232E308 for positive values.
The type-declaration character for Double is the number sign (#).
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Doug Glancy" wrote in message

...
Could you expand on the Dimension comment? I actually Dimensioned as a
Double, not Integer, although normally I would have done a Long, but I
thought I read a post somewhere that Double was more efficient since it

was
native.

As Pikus said earlier today "learn the basics and then you won't be
confused."

!

Doug

"David McRitchie" wrote in message
...
Hi Doug,
If that is a question, 56 colors in the palette in all current

versions of
Excel.

As far as the future goes use Dimension as long instead of integer,
then if Excel is changed you'll be in better shape.

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm


"Doug Glancy" wrote ...
Sure. Until I wrote it I didn't know how many colors there were.

Plus,
I
didn't know if there were more colors in later versions than my

xl2000.

Doug

"pikus " wrote in message
...
I prefer

For x = 1 To 56
Cells(x, 1).Interior.ColorIndex = x
Next x

- Pikus


---
Message posted from http://www.ExcelForum.com/











  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Color index values

I am very impressed with all of the examples given here. I am stil
very new to the whole Macro/VBA scene. i am only used to writing code
out of neccessity, but are there any more "fun" codes like these tha
you can give me? I mean, codes that don't actually do anything ver
important, but just are fun to watch or do? do you know what i mean

--
Message posted from http://www.ExcelForum.com

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Color index values

Scott,

On Sunday, Dick Kusleika on his blog http://www.dicks-blog.com, mentioned
Andy Pope's site http://www.andypope.info which has some really beautiful
stuff. John Walkenbach's site has a whole section of Excel oddities at
http://j-walk.com/ss/excel/odd/index.htm.

hth,

Doug Glancy

"scottnshelly " wrote in
message ...
I am very impressed with all of the examples given here. I am still
very new to the whole Macro/VBA scene. i am only used to writing codes
out of neccessity, but are there any more "fun" codes like these that
you can give me? I mean, codes that don't actually do anything very
important, but just are fun to watch or do? do you know what i mean?


---
Message posted from http://www.ExcelForum.com/



  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Color index values

There's also a page called "Insane Excel" by Dermot Balson with some strange
stuff in it:

http://www.webace.com.au/~balson/Ins...l/Default.html

HTH. Best wishes Harald

"scottnshelly " skrev i
melding ...
I am very impressed with all of the examples given here. I am still
very new to the whole Macro/VBA scene. i am only used to writing codes
out of neccessity, but are there any more "fun" codes like these that
you can give me? I mean, codes that don't actually do anything very
important, but just are fun to watch or do? do you know what i mean?


---
Message posted from http://www.ExcelForum.com/



  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Color index values

I wrote a cool little program that looped through all the colors an
assigned a different one to each cell's interior. I got a really coo
pattern since the screen can only display so many colors at a time I
was especially cool when I filled them in diagonally (A1, A2, B1, A3
B2, C1, etc...) I lost the code I used, but it was pretty easy in th
first place. Like this:

For r = 1 To 255
For g = 1 To 255
For b = 1 To 255
blah blah blah = (r, g, b)
Next b
Next g
Next r

- Piku

--
Message posted from http://www.ExcelForum.com

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
Help in color index function [email protected] Excel Worksheet Functions 2 September 19th 08 03:52 AM
Color Index Code, is there any thing like that? wilchong via OfficeKB.com New Users to Excel 3 May 22nd 08 01:56 PM
Custom Color/Color Index FARAZ QURESHI Excel Discussion (Misc queries) 4 February 29th 08 05:19 PM
Chart axes color index vs font color index [email protected] Charts and Charting in Excel 4 December 7th 06 04:05 PM
How To: Get the index value of the selected color KM[_2_] Excel Programming 1 December 10th 03 04:42 PM


All times are GMT +1. The time now is 02:18 PM.

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

About Us

"It's about Microsoft Excel"