Another how to color excel cell from vb

Posted on 2012-08-21
Last Modified: 2012-08-21
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
Question by:Rick Norris
    LVL 33

    Accepted Solution

    It should be ColorIndex not just Color.

    Author Closing Comment

    by:Rick Norris
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
    The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
    This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now