Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Character.Font Properties.
Hello peoples,
I have a quick question regarding the cells character property in particular when you use the .font.fontstyle property to change the bold properties of in-string text. I have a cell that has a concatenating value, where the cell's value is constantly added to when the criteria matches within a for i loop. I have some code which locates certain characters within the newly added content to bold using the Characters (Start, Length).Font.Fontstyle = "Bold" property. The only problem is that when the property is set, it resets the previous bold property to normal. so in effect only the last value is properly bolded. When you run the marco recorder, it sets the entire string length's property toggling where appropriate. My Question is: Can I store the cell's formatting properties? If so how can I access them? The Output string looks like this (Cell Value): [SE]-TA <Random Info Atts: 0 [TR]-NS <Random Info Atts: 120 [CP]-QL <Random Info Atts: 0 Where text within the "<" & "" is to be bolded. Following is the code use to format the portion of the text to be added. ---------------------------------------------------------- event_conc = "[" & iGroup & "] - " & istate & " <" & iProg & " " & "Atts: " & iAtt & Chr(10) iPosStart = InStr(1, event_conc, "<") + 1 iPosEnd = InStr(1, event_conc, "") - 1 rep_out_count_value = ("rep_out_" & rep_out_count) rep_out_cur_value = Worksheets("Event Calendar").Range(rep_out_count_value).Value strCurrLen = Len(rep_out_cur_value) With Worksheets("Event Calendar").Range ("rep_out_" & rep_out_count) .FormulaR1C1 = rep_out_cur_value & event_conc .Characters(Start:=strCurrLen + iPosStart, Length:=strCurrLen + iPosEnd).Font.FontStyle = "Bold" End With ---------------------------------------------------------- Is there a way I can store the previos property, if not, how would one go about re-formatting the text with multiple inStr("<")'s Your help is greatly appreciated. Paul M. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I use standard notepad (unicode) font for special character | Excel Discussion (Misc queries) | |||
Excel 2007 - Formatting text in cell (character by character) | Excel Discussion (Misc queries) | |||
Excel-Match 1st text character in a string to a known character? | Excel Worksheet Functions | |||
Excel Font question: Can you overscore a character? | Excel Discussion (Misc queries) | |||
Setting Font properties in Code clears Undo list | Excel Programming |