The following code identifies the bold text and ‘tags’ them
Sub Tag_Bold()
Dim oWS As Worksheet
Dim oRng As Range
Dim FirstUL
Set oWS = ActiveSheet
Application.FindFormat.Clear
Application.FindFormat.Font.Bold = True
Set oRng = oWS.Range("A1:A1000").Find(What:="", LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, SearchFormat:=True)
If Not oRng Is Nothing Then
FirstUL = oRng.Row
Do
oRng.Font.Bold = False ' Use this if you want to remove bold
oRng.Value2 = "" & oRng.Value2 & ""
Set oRng = oWS.Range("A" & CStr(oRng.Row + 1) & ":A1000").Find(What:="", LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, SearchFormat:=True)
Loop While Not oRng Is Nothing
End If
End Sub
In the above code we have used
Application.FindFormat.Clear
Clears the criterias set in the FindFormat property and then set the format to find using
Application.FindFormat.Font.Bold = True
Excel with Bold Formatted Text
This is not working error Set Rng what is "o"?
ReplyDeleteSorry I m not Expert
explain in detail
We are assigning a Worksheet Range A1:A1000 to the Range object
ReplyDeleteCan you try
Set oRng = oWS.Range("A1:A1000").Find(What:="", LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, SearchFormat:=True)
The above should be in single line
This worked for me:
ReplyDeleteSub Tag_Bold()
For Each c In [A1:A10]
If c.Font.Bold = True Then
c.Value2 = "-" & c.Value2 & "-"
End If
Next
End Sub
seems quite a bit faster...
Hi Anonymous
ReplyDeleteYour Macro Code Very Useful Us Thanks For Your Valuable Code
If Any New Easy Code is there Pls Sent me
I also a Beginners in Excel Macro i want to Your Help
If you Dont mine pls Visit My Blog www.amudhaExceltips.blogspot.com
Keep in touch Always
Thanks
how do i do the same thinig but i would need to find specifice bold values within a cell...
ReplyDelete