What I want to do is the following: I have around ~1400 rows full of data, of which the last column contains a lot of text. Here's an image to show what I mean: image removed because I can only post 2 links at once.
Now, to make that text easier to read, I want to bold some words of it.
Right now I have the following macro:
Dim range As range Set range = Application.Selection Dim boldwords As Variant boldwords = Array("Atemschutz:", "Körperschutz:", "Handschutz:", "Augenschutz:") Dim cell As range For Each cell In range For Each bword In boldwords foundword = InStr(1, cell.Text, bword, VbCompareMethod.vbTextCompare) If foundword <> 0 Then cell.Characters(foundword, Len(bworld)).Font.Bold = True End If Next Next
- Loop through all cells selected
- loop through all the words that should be bolded and check if they are contained in the cell
- If they are, bold them
Now my Problem is, once I run it my text either gets bolded completely or gets garbled Like this , or it places every letter on a separate line. Excel either slows down, freezes or sometimes crashes after that.
What can be done to prevent this?
UPDATE: After correcting the variable name Siphor mentioned, the text is no longer garbled but still gets split into separate lines sometimes, here's an image to show what I mean: click me