Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel: Programmatically highlighting portions of a cell
Message
From
27/12/2006 19:43:40
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01180405
Message ID:
01180618
Views:
13
Thanks, Yuri.

Your suggestion works if the cell is simple text, but, from what I can tell, not if its a formula. Fortunately for me, at the time that it matters whether the text is highlighted, I've done a "paste special" so that the cell is simple text, so your suggestion is just what I needed.

>Something like this:
>
>
>oExcel=GETOBJECT(,"Excel.Application")
>WITH oExcel.ActiveSheet.range(....)
>	lnstart=AT("NEW", .text)
>	IF lnstart >0
>		WITH .Characters(lnstart,3).Font
>		   .FontStyle = "Bold"
>    	           .ColorIndex = 3
>		ENDWITH
>	ENDIF
>ENDWITH
>
>oExcel=null
>
>
>
>>How can I go about highlighting a portion of a cell that is defined by a formula?
>>
>>I have kind of an unusual situation in an Excel spreadsheet. The user works in one worksheet where all the columns (except the first) are formulas that read their info from a different worksheet which my program maintains (these are part descriptions, UPC codes, etc.) The user enters the part number in the first column, and the rest of the columns are automatically updated. (The user also controls rows at the top of each page, etc., to create something that can be printed and distributed to customers).
>>
>>The difficulty is that this technique only fills in the values from the worksheet that my program maintains. What is desired is that for items that are new, the word "NEW" appear after the part description, and the word "NEW" should be bold and in red. (This is the way it was handled when the entire process was manual).
>>
>>So, the following formula reads the part description, and inserts the word "NEW" if appropriate.
>>
>>
=VLOOKUP( $B18, Parts!$A$2:$Y$10000, 2, FALSE) & IF( VLOOKUP( $B18, Parts!$A$2:$Y$10000, 5, FALSE) = "T", "   NEW", "")
>>Any suggestions on how I can make that word appear bold and in red?
>>
>>TIA,
Jim Nelson
Newbury Park, CA
Previous
Reply
Map
View

Click here to load this message in the networking platform