aurelius89
Board Regular
- Joined
- Mar 15, 2017
- Messages
- 69
In a column, I want to replace all the "o" with "0"
This would be easy however the "o" could be part of other text in the cell, I don't want to replace ALL the cell with "0", only when it finds "o"
e.g - B1o becomes B10
I have found something like this, where within the Loop I could use REPLACE instead of what they have here:
However, adding another loop to my already extensive code is going to slow it down even more.
I was wondering if there was a simpler/better way to achieve this?
Many Thanks
This would be easy however the "o" could be part of other text in the cell, I don't want to replace ALL the cell with "0", only when it finds "o"
e.g - B1o becomes B10
I have found something like this, where within the Loop I could use REPLACE instead of what they have here:
Code:
Sub Test()
Dim Rng As Range
Dim c As Range
Dim Length As Integer
Dim LeftSide As Integer
Dim RightSide As Integer
Set Rng = Range("D6:D" & Range("D65536").End(xlUp).Row)
For Each c In Rng
LeftSide = InStr(c, "|")
RightSide = InStr(LeftSide + 1, c, "|")
Length = RightSide - LeftSide
If Length > 0 Then
c.Characters(Start:=LeftSide, Length:=Length).Font.FontStyle = "Bold"
End If
Next c
End Sub
However, adding another loop to my already extensive code is going to slow it down even more.
I was wondering if there was a simpler/better way to achieve this?
Many Thanks
Last edited: