I currently have to send multiple letters out at one time and often replace only 1 or two words within a cell. The problem is that I need those words to be bolded and it would b
You are setting up a loop to go through each worksheet (using ws
as your reference to the sheet currently being processed), but then processing a range on the ActiveSheet
. Use ws
instead of ActiveSheet
.
You should also set rng
to Nothing
before attempting to set it to the UsedRange.SpecialCells
or else, if that crashes, your If rng Is Nothing Then
statement won't work (because rng
will still be set to whatever it was set to on the previous iteration through the loop).
'...
For Each ws In ActiveWorkbook.Worksheets
Set rng = Nothing
On Error Resume Next
Set rng = ws.UsedRange.SpecialCells(xlCellTypeConstants, xlTextValues)
On Error GoTo ErrHandler
If rng Is Nothing Then
'...