Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to directly read in the colorindex of cell into an
array? As you can see by the code below, I can get the value ok but not the colorindex value. I know I could probably do a "For Each Cell in Range("A1:C5")" type of command and get the colorindex number that way but I thought the code below should work. Any ideas? Sub GetCellValueAndColor() ' cell A1 contains the number 123 and the font color is Red ' ColorIndex number for Red is 3 Dim ArrayCellValue As Variant, ArrayCellColor As Variant ArrayCellValue = Range("A1:C5").Value ArrayCellColor = Range("A1:C5").Font.ColorIndex MsgBox ArrayCellValue(1, 1) ' displays 123 ' display A1 Only for test MsgBox Range("A1").Font.ColorIndex ' displays 3 MsgBox ArrayCellColor(1, 1) 'Type mismatch MsgBox Str(ArrayCellColor(1, 1)) 'Type mismatch MsgBox Val(ArrayCellColor(1, 1)) 'Type mismatch MsgBox CStr(ArrayCellColor(1, 1)) 'Type mismatch End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
tab.colorindex linked to cell color | Excel Worksheet Functions | |||
How to get cell colorindex of conditional formatted cells | Excel Discussion (Misc queries) | |||
Cell.interior.colorindex - does not work in Excel 97 | Excel Programming | |||
Name of color for a particular colorindex number | Excel Programming | |||
need to set a cell background color which is not within the Excel colorindex range | Excel Programming |