|
-
Feb 22nd, 2006, 03:28 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] EXCEL: ? Range of Cell Fill Colors
Esteemed Forum Participants and Lurkers:
===============================
Excel 2003 VBA
As near as I can tell, the range of Fill Colors for Cells is from 0 to 56, and -4142. Is this all I get? No custom color fill?
By the way, here is a macro to build a map of Color Index values in Column A, and Column B filled with that color. Run it on a blank sheet:
Code:
Option Explicit
'Display your COLOR PALLETTE
Sub Macro1()
Dim i As Integer
Dim jRow As Integer
'Start at the first row
jRow = 1
'This is a funny Color Index, but it works!
i = -4142
'Load the funny color
Cells(jRow, "A").Value = i
Cells(jRow, "B").Interior.ColorIndex = i
'Walk down the sheet putting the index in A and coloring B
For i = 0 To 57
jRow = jRow + 1
On Error GoTo ERROR_COLOR_INDEX
Cells(jRow, "A").Value = i
Cells(jRow, "B").Interior.ColorIndex = i
On Error GoTo 0
Next i
Exit Sub
'
ERROR_COLOR_INDEX:
Cells(jRow, "A").Value = i
Cells(jRow, "B").Value = "END"
End
End Sub
Last edited by Webtest; Feb 23rd, 2006 at 08:15 AM.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Feb 22nd, 2006, 03:37 PM
#2
Re: EXCEL: ? Range of Fill Colors ???
Instead of the .ColorIndex property use the .Color property with an RGB color value.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 22nd, 2006, 03:41 PM
#3
Re: EXCEL: ? Range of Fill Colors ???
u are just full of info today!! writing that one down as well LOL
I need to give some reps to others so I can hit u again!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 22nd, 2006, 03:59 PM
#4
Lively Member
Re: EXCEL: ? Range of Fill Colors ???
Today? Rob has made me change my underwear more often than my washing machine can handle.
-
Feb 22nd, 2006, 04:03 PM
#5
Re: EXCEL: ? Range of Fill Colors ???
Thanks guys. Its always nice to hear positive feedback for all my efforts. I have been side tracked for the past couple of months and now getting ready to get back deep into programming so be warned and make sure your wearing some Depends for protection.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 22nd, 2006, 06:26 PM
#6
Re: EXCEL: ? Range of Fill Colors ???
Incidentally, I listed all the colours in an Enum here...
Also, you can use the Pattern property to give it stripes or a grid.
zaza
-
Feb 23rd, 2006, 08:10 AM
#7
Thread Starter
Frenzied Member
Re: EXCEL: ? Range of Fill Colors ???
 Originally Posted by RobDog888
Instead of the .ColorIndex property use the .Color property with an RGB color value.
Thanks for the tip RobDog, but it is an "Optical Delusion". I was playing with light gray, but the lightest gray I can get is "aCell.Interior.Color = RGB(223, 223, 223)". When I increment to "(224, 224, 224)" the cell goes from medium gray to white, and of course is white for all values from 224 through 255.
I settled on a light yellow (ColorIndex = 19) that results in a fairly pale gray on a B&W laser printer. Reading back the Color for a cell at ColorIndex = 19 yields an RGB value of (255, 255, 204). Changing the Blue value from 204 to 229 does nothing. It switches to White from 230 to 255. So, we are essentially still stuck with the ColorIndex pallette for cell fill, but thanks for the insight.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Feb 23rd, 2006, 11:54 AM
#8
Re: [RESOLVED] EXCEL: ? Range of Cell Fill Colors
Shouldnt it be an "Optical Illusion" ? I didnt test it with such a detailed color range so thanks for letting us know its limitation.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 23rd, 2006, 12:07 PM
#9
Re: [RESOLVED] EXCEL: ? Range of Cell Fill Colors
Oh I just remembered that when I was creating custom labels for appointments in Outlook there were only certain colors that would display in terminal server because of a 256 color depth desktop. Are you running True color color depth?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 23rd, 2006, 12:28 PM
#10
Thread Starter
Frenzied Member
Re: [RESOLVED] EXCEL: ? Range of Cell Fill Colors
RobDog ...
The quotes are significant ... "Optical Delusion" ... Thinking you're getting something really neat visually, but not quite ...
I was going to mention it but forgot ... (Senior Moment) ...
Display Properties > Settings > Display > Colors > True Color (32 bit)
We are definitely limited to a pallette for Cell Fill.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
Feb 23rd, 2006, 12:32 PM
#11
Re: [RESOLVED] EXCEL: ? Range of Cell Fill Colors
Yes, graphics are limited in all of VBA. No picturebox control, no drawing on a userform, etc.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|