Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 692
  • Last Modified:

Another how to color excel cell from vb

There are a multitude of questions asked on this topic; however, I have not been able to find an exact answer for my particular situation.  Lots of questions already posed are for older versions of vb .net that I do not think work in my environment.  

I am using vb .net 2010.  

I want to be able to assign a specific background color to as specific cell within an excel spreadsheet from vb.  From questions posed and answered before, I have come up with the following:

oSheet is defined as the active excel sheet.

 oSheet.Cells(intRow, intCol).Interior.Color = ConsoleColor.Red


 oSheet.Cells(intRow, intCol).Interior.Color = 8

BOTH of the above actually color the specified cell; however, the color is BLACK.  Yes, I have tried NUMEROUS values.  I have even cycled through a range of 8 through 100, and placed in 93 different cells, but the background color is always black.

I am sure I am doing something stupid.

Any and all help is greatly appreciated.

thanks in advance.

Rick Norris
Rick Norris
Rick Norris
1 Solution
NorieData ProcessorCommented:
It should be ColorIndex not just Color.
Rick NorrisAuthor Commented:
I knew I had done something STUPID!!  

Your answer was exactly what I needed.  Thank you so much.  You have no idea how much I have struggled with just this one little item over the last several days!!

Again, THAN YOU!!

Rick Norris

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now