![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 2
|
Hello,
I have a test program that I worte in C++, which outputs a bunch of measurement data into an Excel format with an "xls" extention. Is there a way to have my program append commands that would format the cell "color" based on measurement results? This would be conditional formatting that is performed when the file is opened. I appreciate any suggestions! |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Iserrano, Check out the following discussion, it discusses how to conditionally format cells. You'll probably want to add different criteria based on value ranges.
Cheers, Nate http://www.mrexcel.com/board/viewtop...=343&forum=2&6 [ This Message was edited by: NateO on 2002-02-21 17:24 ] |
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Posts: 2
|
Thanks Nate,
But that requires the conditional format to be performed by the user, after the file has been opened. As an ex. if my data is less than zero, I would like to use something like "=format_cell("color",RBG)" to be run at file open. Hope that makes sense. |
|
|
|
|
|
#4 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Well, if it's a new file, then yes. But once you layer the format on, then it's there and dynamic. So you're saying it's a new workbook....The plot thickens....
|
|
|
|
|
|
#5 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Something along these lines may work. When the workbook opens, this will test a range and fill it in accordingly:
sub auto_open() For Each cell In Range("A1:C4") if cell.value < 1000 cell.Interior.ColorIndex = 28 end if If cell.Value >= 1000 Then cell.Interior.ColorIndex = 6 end if Next cell end if End Sub I haven't tested this so hopefully it's all good. Cheers, Nate |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|