Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Word of caution: I have _never_ done any excel programming before (lots
of C++, C, Python, Java etc. though). I have an excel file that contains 25 worksheets. Each sheet contains (apart from som text here and there) a 12x12 grid of cells containing mainly just color information. That is, a cell is white, green, red, blue etc. In some of these colored cells, there is also text. Now, I need to extract data from these sheets into some simple format that is easy to parse. I have tried using a Python excel reading module, but it disregards color information. Is there some tools that can extract data (also color information) from excel into some simpler format (CSV is without color information too)? Or can I make a simple excel program that puts a certain string into a cell depending on each color? Then I can read this content with the python module etc. /David |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you select some cells and run this macro:
Sub colorcode() Dim r As Range For Each r In Selection r.Value = r.Interior.ColorIndex Next End Sub The contents of the cells will be set to the background color index. -- Gary's Student " wrote: Word of caution: I have _never_ done any excel programming before (lots of C++, C, Python, Java etc. though). I have an excel file that contains 25 worksheets. Each sheet contains (apart from som text here and there) a 12x12 grid of cells containing mainly just color information. That is, a cell is white, green, red, blue etc. In some of these colored cells, there is also text. Now, I need to extract data from these sheets into some simple format that is easy to parse. I have tried using a Python excel reading module, but it disregards color information. Is there some tools that can extract data (also color information) from excel into some simpler format (CSV is without color information too)? Or can I make a simple excel program that puts a certain string into a cell depending on each color? Then I can read this content with the python module etc. /David |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() On Nov 7, 10:08 am, Gary''s Student wrote: If you select some cells and run this macro: Sub colorcode() Dim r As Range For Each r In Selection r.Value = r.Interior.ColorIndex Next End Sub The contents of the cells will be set to the background color index. If you want RGB values, the Interior.Color property (I'm not sure which XL version this appeared in, but probably 2000) returns a Long, which can be transformed into RGB values using something like this: Dim R As Long Dim G As Long Dim B As Long R = colorValue Mod 256 G = (colorValue - R) / 256 Mod 256 B = (colorValue - R - G * 256) / 256 / 256 Mod 256 Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
retrieve information from clipboards not in the reading pane | Excel Discussion (Misc queries) | |||
Reading information from a closed workbook | Excel Programming | |||
Reading the Clipboard Source Information | Excel Programming | |||
Reading a color, and setting a value | Excel Programming | |||
Reading information from all workbooks in a folder... | Excel Programming |