Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba to convert htm tags
I am needing to use VBA to do this:
Find every cell in my sheet that is bold, and replace it with "^b" plus whatever text is in the cell, and another "^b" I also need to do the reverse: find any cell that has ^b in it, and remove the ^b, and make that cell bold I've tried figuring this out with the record macro feature, but it doesn't seem to record some of the find/replace features correctly when working with finding the bold font. thanks, southernatheart |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba to convert htm tags
The problem might be easy if the entire cell was bold, but I suspect you want to bold just some of the text in a cell.
Some time ago I wrote something similar, which took what resembled html code, and applied it to an Excel cell. http://vangelder.orcon.net.nz/excel/incellformat.zip Let me know if that suits, otherwise reply and I'll see what can be done. Cheers, Rob Southern at Heart wrote: I am needing to use VBA to do this: Find every cell in my sheet that is bold, and replace it with "^b" plus whatever text is in the cell, and another "^b" I also need to do the reverse: find any cell that has ^b in it, and remove the ^b, and make that cell bold I've tried figuring this out with the record macro feature, but it doesn't seem to record some of the find/replace features correctly when working with finding the bold font. thanks, southernatheart |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
vba to convert htm tags
Try this and let me know what you think:
Sub BoldFonts() Dim SearchRange As Range, Cell As Range, BoldFonts As Range, x% Set SearchRange = Cells.SpecialCells(xlCellTypeConstants) For Each Cell In SearchRange If Cell.Font.Bold = True Then If x = 1 Then Set BoldFonts = Union(BoldFonts, Cell) Else Set BoldFonts = Cell x = 1 End If End If Next Cell BoldFonts.Select For Each c In Selection If c.Value < "" Then c.Value = "^b" & c.Value & "^b" Next c End Sub Thanks! Ryan-- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Southern at Heart" wrote: I am needing to use VBA to do this: Find every cell in my sheet that is bold, and replace it with "^b" plus whatever text is in the cell, and another "^b" I also need to do the reverse: find any cell that has ^b in it, and remove the ^b, and make that cell bold I've tried figuring this out with the record macro feature, but it doesn't seem to record some of the find/replace features correctly when working with finding the bold font. thanks, southernatheart |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
name tags | Excel Discussion (Misc queries) | |||
How do I convert HTML tags within cell to text? | Excel Programming | |||
no smart tags | New Users to Excel | |||
Smart tags | Excel Discussion (Misc queries) | |||
mp3 tags | Excel Programming |