Hello Im using Visual Studio 2010 beta release.. and Excel Interop library
Let me explain better what I'm trying to do:
If the cell value of A1 is the text "TRUE", then I want to change the cell background of A2 to color GREEN
How do I do this?
J
Loading
j lPosted Feb 22, 2010, 1:18 PM
Here is the code that I've tried. I get an exception error at the "IF" statement
int rowIndex = 1; int colIndex = 1;
excelApp.Cells[rowIndex, colIndex] = "True";
if (excelApp.Range[rowIndex, colIndex].Value = "True")
excelApp.Range[rowIndex, colIndex].Interior.ColorIndex = 4;
else
excelApp.Range[rowIndex, colIndex].Interior.ColorIndex = 3;
Can anyone tell me whats wrong with my code?
J
Sam HobbsPosted Feb 22, 2010, 12:40 PM