Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Yuby Mona la Simpatie.ro
Femeie
23 ani
Arges
cauta Barbat
23 - 45 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Bold only Certain Parts of Text in a Cell Range [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
Below it's the code from source adapted for my needs. I then made a button in the sheet and assigned the code below to it.



Sub ConvertSpecificTextToBold()

Dim Rng As Range
Dim myCell As Object
Dim lastRow As Long
    lastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).Row

Set Rng = ActiveSheet.Range("D4:D" & lastRow)

s1 = "Masuri tehnice"
s2 = "Masuri organizatorice"

For Each myCell In Rng
    If InStr(myCell.Text, s1) Then
      myCell.Characters(WorksheetFunction.Find(s1, myCell.Value), Len(s1)).Font.Bold = True
    End If
Next

For Each myCell In Rng
    If InStr(myCell.Text, s2) Then
      myCell.Characters(WorksheetFunction.Find(s2, myCell.Value), Len(s2)).Font.Bold = True
    End If
Next

End Sub


Source:


pus acum 2 ani
   
Pagini: 1  

Mergi la