Results 1 to 5 of 5

Thread: Set Backcolor of a Excel cell

  1. #1
    Join Date
    May 2008
    Posts
    255

    Set Backcolor of a Excel cell

    I am trying to write a simple formula that will give me the background color of a cell (in Excel). Something along the lines of, if background color is black, enter text from cell into another cell.

    Does anyone have any suggestions?

  2. #2
    Join Date
    Dec 2007
    Posts
    1,736

    Re: Set Backcolor of a Excel cell

    You have to use the Interior property of cells, and then, you can use either ColorIndex (To use one of the 56 "presets" colors in Excel) or Color, like this

    ActiveCell.Interior.ColorIndex = 36

    OR

    Range("A1:A6").Interior.Color = RGB(200,160,35)

  3. #3
    Join Date
    Apr 2008
    Posts
    264

    Re: Set Backcolor of a Excel cell

    Hi
    In C# i can set the backcolor of a cell like this

    worksheet.get_Range("B1:B1", Type.Missing).Interior.ColorIndex = 1;

    I need to set the color without using ColorIndex, ie any color using
    Color.FromARGB(205, 255, 255)

    I tried the following
    worksheet.get_Range("B1:B1", Type.Missing).Interior.Color =
    Color.FromARGB(205,255,255);

    But it show an error. Does someone know how to acheve this.

  4. #4
    Join Date
    Jun 2006
    Posts
    623

    Re: Set Backcolor of a Excel cell

    Take a look at this from Microsoft. You most probably will find the answer.
    Changing the Background Color of a Cell

  5. #5
    Join Date
    May 2008
    Posts
    518

    Re: Set Backcolor of a Excel cell

    You have to use the Interior property of the cell, and then:

    You can use ColorIndex (to use one of the 56 "preset" colors in Excel):
    Code:
    ActiveCell.Interior.ColorIndex = 36
    Or you can use Color:
    Code:
    Range("A1:A6").Interior.Color = RGB(200,160,35)

Similar Threads

  1. How to disable excel for taking empty cell in Excel chart
    By Hache hi in forum MS Office Support
    Replies: 2
    Last Post: 25-02-2012, 12:30 PM
  2. Applying absolute cell referencing to many cell in Excel
    By Nyota in forum MS Office Support
    Replies: 2
    Last Post: 24-02-2012, 07:23 PM
  3. Cell format errors appears in Excel 2003 but not in Excel 2000
    By @nki$achi in forum MS Office Support
    Replies: 1
    Last Post: 24-01-2012, 05:00 PM
  4. How to fix a cell number in excel for mac os
    By Shaina Na in forum Windows Software
    Replies: 1
    Last Post: 08-01-2012, 11:25 AM
  5. Replies: 2
    Last Post: 04-01-2012, 06:54 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,229,578.63023 seconds with 17 queries