1

I want to color some particular cells of an Excel sheet in C#. I am using this code:

((Range)worksheet.Cells[2, 1]).Interior.Color = XlRgbColor.rgbDarkRed;

But it's throwing an exception:

Exception from HRESULT: 0x800A03EC

How can I resolve this?

Michael Petrotta
  • 58,479
  • 27
  • 141
  • 176

1 Answers1

1

try this it will solve your problem

 ((Range)worksheet.Cells[i + 2, j + 1]).Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
sanjeev
  • 560
  • 1
  • 11
  • 20