ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting Text (https://www.excelbanter.com/excel-programming/319156-formatting-text.html)

Vinny Bambarino

Formatting Text
 
My spreadsheet has a long string of text in one cell, I only need one word in
the string bolded. I need an automated method due to the number of cells.
Can I capture the data with vba bold part of the string and put it back into
the cell?

Any help would be greatly appreciated.



Jim Thomlinson[_3_]

Formatting Text
 
Here try this procedure... It bolds the word Tada...

Private Sub test()
Dim rngCurrent As Range
Dim intFound As Integer
Dim strToFind As String
Dim intLength As Integer


strToFind = "Tada"
intLength = Len(strToFind)
Set rngCurrent = Sheets("Sheet1").Range("A1")

Do While rngCurrent.Value < Empty
intFound = InStr(rngCurrent.Value, "Bold")
If intFound 0 Then
rngCurrent.Characters(intFound, intLength).Font.FontStyle = "Bold"
End If
Set rngCurrent = rngCurrent.Offset(1, 0)
Loop
Set rngCurrent = Nothing
End Sub

"Vinny Bambarino" wrote:

My spreadsheet has a long string of text in one cell, I only need one word in
the string bolded. I need an automated method due to the number of cells.
Can I capture the data with vba bold part of the string and put it back into
the cell?

Any help would be greatly appreciated.




All times are GMT +1. The time now is 09:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com