|
-
May 23rd, 2006, 03:50 AM
#1
Thread Starter
Don't Panic!
[RESOLVED] [Excel] Interior Colours (or colors)
Hi,
In Excel it says you can change the colour using the rgb function and setting the interior colour to that.
This seems to work. Well no it doesn't. This gets your colour and matches it to the nearest index.
Is it possible to show colours not in the index list?
If so - how?
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
May 23rd, 2006, 04:06 AM
#2
Re: [Excel] Interior Colours (or colors)
I remember reading a thread before about a similar isue. I think it was found that only the colorindex would work as certain rgb values didnt make color changes but some did, just not all.
Try a search for the thread here in OD for more info on it.
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 
-
May 23rd, 2006, 09:50 AM
#3
Thread Starter
Don't Panic!
Re: [Excel] Interior Colours (or colors)
Found your previous post - seems to be limited now (I think I recall a v97 working with custom colours, but nothing like that now).
Thanks for your help.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
May 23rd, 2006, 02:50 PM
#4
Frenzied Member
Re: [RESOLVED] [Excel] Interior Colours (or colors)
Vince ... here is the post: [RESOLVED] EXCEL: ? Range of Cell Fill Colors
Here is a little demo to display all of the possible valid indices and their colors:
Code:
Option Explicit
'Display your COLOR PALETTE
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
I learned just today that the Visual Basic Editor/Debugger can actually change your color palette! My assistant thought he was going crazy because cells that have been 'Light Turquoise' for ages suddenly changed color and several color names changed to "color scheme". When he closed Excel and then reopened it, the colors reverted to their 'traditional' hues.
Last edited by Webtest; May 23rd, 2006 at 02:57 PM.
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
May 23rd, 2006, 02:59 PM
#5
Re: [RESOLVED] [Excel] Interior Colours (or colors)
Yes, thats the thread. 
Nice .colorindex code Art
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 
-
May 23rd, 2006, 03:10 PM
#6
Re: [RESOLVED] [Excel] Interior Colours (or colors)
I just noticed that I dont get a color for "-4142" what color is it supossed to be?
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 
-
May 23rd, 2006, 03:38 PM
#7
Frenzied Member
Re: [RESOLVED] [Excel] Interior Colours (or colors)
Do: "MsgBox Range("A1").Interior.ColorIndex" on a newly created sheet ... "No Fill" ... seems to be exactly the same as ColorIndex = 0!
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
May 23rd, 2006, 03:43 PM
#8
Frenzied Member
Re: [RESOLVED] [Excel] Interior Colours (or colors)
In fact, if you set a cell ColorIndex to 0 in code and then immediately read it back in the next line, you'll see the "-4142" and not the 0!
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
-
May 24th, 2006, 03:29 AM
#9
Thread Starter
Don't Panic!
Re: [RESOLVED] [Excel] Interior Colours (or colors)
Cheers. That was the thread I found.
Doesn't seem to be a point in giving vba coders the choice of putting a custom colour into the cells background then automatching to an indexed colour. Another great idea from MS...
The code to loop through the indexes is great. I think I wrote something like it that displayed the colours on a sheet, but it was about a year ago. Probably lost the code somewhere 
Thanks for your help
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
May 24th, 2006, 06:36 AM
#10
Frenzied Member
Re: [RESOLVED] [Excel] Interior Colours (or colors)
Vince ...
Any time my assistant or I does a short routine to test or proof something, we put it in a special "Cookbook" folder on our shared "Teamwork" drive. There are about 25 examples right now ... that's how I came up with the Color Chart so quickly. That's about my only claim to 'organizational skills'.
What is really nasty about the Palette system is that there are some VERY useful colors (Extra Light Yellow) that can ONLY be set programmatically! There are only 41 of the available color selections on the "Fill Color" Tool. Yuk!
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
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
|