![]() |
Tagging formatting (cells with mixed formatting)
I need to tag all formatting (bold, itlaic, bold italic, superscript,
underline, etc) in all the cells throughout a worksheet. The way I am doing it is looping through each cell of the UsedRange and then through each character of each cell. I am wondering if there is a better/faster way to do this. Any help would be much appreciated. Here is what I have so far, I still have to add the Else If statements for all the other formatting: For Each myCell In rng.Cells myBold = myCell.Font.Bold If myBold = False Then 'do nothing ElseIf myBold = True Then 'tag whole cell myCell.Value2 = "<bold" & myCell.Value2 & "</bold" Else 'we have a mixture so we must loop through each character in cell myStr = "" For iCtr = 1 To Len(myCell.Value) If myCell.Characters(Start:=iCtr, Length:=1).Font.Bold = True Then myStr = myStr & "<bold" & Mid(myCell.Value, iCtr, 1) & "</bold" Else myStr = myStr & Mid(myCell.Value, iCtr, 1) End If Next iCtr myCell.Value = myStr End If Next myCell |
All times are GMT +1. The time now is 03:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com