Cell Formatting From C++ output
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Cell Formatting From C++ output

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Hello,

    I have a test program that I worte in C++, which outputs a bunch of measurement data into an Excel format with an "xls" extention. Is there a way to have my program append commands that would format the cell "color" based on measurement results? This would be conditional formatting that is performed when the file is opened.

    I appreciate any suggestions!

  2. #2
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Iserrano, Check out the following discussion, it discusses how to conditionally format cells. You'll probably want to add different criteria based on value ranges.

    Cheers, Nate

    http://www.mrexcel.com/board/viewtop...=343&forum=2&6

    [ This Message was edited by: NateO on 2002-02-21 17:24 ]

  3. #3
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Nate,

    But that requires the conditional format to be performed by the user, after the file has been opened. As an ex. if my data is less than zero, I would like to use something like "=format_cell("color",RBG)" to be run at file open.

    Hope that makes sense.

  4. #4
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Well, if it's a new file, then yes. But once you layer the format on, then it's there and dynamic. So you're saying it's a new workbook....The plot thickens....

  5. #5
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Something along these lines may work. When the workbook opens, this will test a range and fill it in accordingly:

    sub auto_open()
    For Each cell In Range("A1:C4")
    if cell.value < 1000
    cell.Interior.ColorIndex = 28
    end if
    If cell.Value >= 1000 Then
    cell.Interior.ColorIndex = 6
    end if
    Next cell
    end if

    End Sub


    I haven't tested this so hopefully it's all good. Cheers, Nate


User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com