how can i read color coded cell in excel sheet using vb.net
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: how can i read color coded cell in excel sheet using vb.net

  1. #1
    Join Date
    Feb 2005
    Posts
    17

    Question how can i read color coded cell in excel sheet using vb.net

    Hi codeguru,

    I have a color coded excel sheet that is every cell has a different color. How can I read the colors in vb.net. I appreciate any help.

    Thanks,
    raf35

  2. #2
    Join Date
    Dec 2002
    Posts
    305

    Re: how can i read color coded cell in excel sheet using vb.net

    Here is a solution to use the color by using its index.

    dim colorindex as integer
    colorindex = ExcelSheet.Range("A1:A1").Interior.IolorIndex

    Once you read the color index, you can change color in another cell by

    ExcelSheet.cells(5,1).Interior.ColorIndex = colorindex


    You can also check if another cell has this same color by

    if colorindex = ExcelSheet.Cells(5,1).Interior.colorindex then

    ...

    endif

    I don't know how to convert color index to a color object in System.Drawing. Hope this will do what you want. Good Luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center