Re: Cell Shading Colour Property

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I meant to point out that the colors assigned to the various color indexes are not "fixed"... they can be changed. For example, if you executed this line...

ActiveWorkbook.Colors(3)=vbGreen

the Red color normally associated with ColorIndex 3 would change to green. You can set it back to its red color by executing this line...

ActiveWorkbook.Colors(3)=vbRed

The point is, the colors a user sees for a given ColorIndex might be different than the color you see; so, naming the colors as you are doing might possibly lead to misinterpretations.

--
Rick (MVP - Excel)


"Rick Rothstein" <rick.newsNO.SPAM@xxxxxxxxxxxxxxxxxx> wrote in message news:uf28EgwNKHA.4964@xxxxxxxxxxxxxxxxxxxxxxx
I don't think there are "official" names for all the colors, but if you copy/paste this code line into the Immediate window and execute it (you can also but a Sub/EndSub around it and execute it as a macro if you want), the code will fill the first 56 rows with the 56 available color indexes... you can look at them and decide on the names to describe them yourself.

For X = 1 To 56: Cells(X, "A").Interior.ColorIndex = X: Next

--
Rick (MVP - Excel)


"Tim Childs" <noreply@xxxxxxxxxxxxx> wrote in message news:%239sH0TwNKHA.1372@xxxxxxxxxxxxxxxxxxxxxxx
Hi

The first function gives a cell's shading colour-index property and the second converts it to a description. Has anyone the list of indexes and a colour description so I no longer need the Else statement near the end. I wnated to cover the basic colours in the Format cells tab, 40+ I suppose

Thanks

Tim

PS hope the US colleagues will forgive "colour" variant spelling :)

Function ShowColourIndexNo(Cell As Object) As Integer
ShowColourIndexNo = Cell.Interior.ColorIndex
End Function

Function ConvertColorIndexToText(Cell As Object) As String
Dim Temp As Variant

Select Case Cell.Value
Case -4142
Temp = "No colour"
Case 3
Temp = "Bright red"
Case 4
Temp = "Bright green"
Case 5
Temp = "Dark blue"
Case 34
Temp = "Light blue"
Case 35
Temp = "Light green"
Case Else
Temp = "Non-specified"
End Select

ConvertColorIndexToText = Temp

End Function




.



Relevant Pages

  • RE: temporary table "disapears"
    ... The temp tables should only be dropped when the connection ... Andon said that batching all the commands in the same execute is not an ... However they were both run on the same connection (same $dbh ... Toute utilisation de ce ...
    (perl.dbi.users)
  • Re: Returning recordsets from stored procedures
    ... We have a web application using stored procedures to generate the report data into temp tables from where we currently select the data; is it possible in IDS to circumvent the need for the temp tables and return the data direct from the stored procedure? ... Just add the WITH RESUME clause to the RETURN statement inside the FOREACH loop and each time the procedure is called from a cursor in the calling program it will return the next data row. ... Then you can call the procedure from an execute statement in pure SQL, or you can cast the procedure call to a MULTISET, or in 11.10+ you can EXECUTE it in the FROM clause of a SELECT statement. ...
    (comp.databases.informix)
  • Re: A freshmans question
    ... Do the assignment. ... terrible,I don't understand all of your meaning. ... 0,then don't execute the i++, execute the next statement and print ... temp = i; ...
    (comp.lang.java.programmer)
  • Open a query and pausing for changes
    ... I have created a series of queries that alone executed in order work as ... What I am trying to do is execute the set of queries via a command button. ... from entering the changes needed to the temp tables. ...
    (microsoft.public.access.formscoding)
  • Re: Cell Shading Colour Property
    ... I don't think there are "official" names for all the colors, but if you copy/paste this code line into the Immediate window and execute it, the code will fill the first 56 rows with the 56 available color indexes... ... Dim Temp As Variant ... Temp = "Dark blue" ... Temp = "Light blue" ...
    (microsoft.public.excel.programming)