Formatting Text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top