Edit & changing colors in specific cell in excel


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Edit & changing colors in specific cell in excel

Hybrid View

  1. #1
    Join Date
    Mar 2005
    Posts
    3

    Edit & changing colors in specific cell in excel

    Hi
    I'm writing a project in VB.NET using Excel.
    I want to know how can I insert string to specific cell, how can I change the color of specific cell, and how can i fill sheet (making loops that run through all the columns and rows that I'm telling it too).
    Thanks

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    The following should get you started:

    How to automate Microsoft Excel from Visual Basic .NET

    In addition, the macro recorder in Excel is a good tool for generating code and learning the object model.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    Mar 2005
    Posts
    3

    changing colors in excl from vb.net

    Hi
    I'm trying to change the color of Excel's cell by
    exWS.Range("B2", "F2").Font.Color.System.Drawing.Color.Red()
    but it gives me an error
    what's the correct way to do this?

  4. #4
    Join Date
    Dec 2003
    Posts
    2,750
    Not sure if you're trying to change the Font color or Cell Interior, but I'm assuming the latter:

    .Range("B2", "F2").Interior.ColorIndex = 3
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  5. #5
    Join Date
    Jan 2005
    Location
    New Zealand
    Posts
    319

    Excel 2003 Row Specific Cell Font Color Setting

    Quote Originally Posted by biot View Post
    Hi
    I'm trying to change the color of Excel's cell by
    exWS.Range("B2", "F2").Font.Color.System.Drawing.Color.Red()
    but it gives me an error
    what's the correct way to do this?
    --------------------------------------------------------------------

    Hi Friend,

    I did encounter the same problem 3 hours ago and I tried out this coding and surprsing it works. I am using VBNEt2008 and EXCEL 2003

    this is the coding that I tried and it works:
    xlWrkSheet.Cells(intRow, icol).Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Blue)


    Hope you try it
    Cheers,
    Lennie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center