VBA code to replace envelope values with >> or << copied to Excel. Makes the replaced cells bold as well.
Sub Replace()
'''REPLACE SOMETHING IN CELL'''
Dim rngStartCol As Integer
Dim rngEndCol As Integer
Dim rngStartRow As Integer
Dim rngEndRow As Integer
Dim rngUsed As Range
Dim rngActive As Range
Dim rngReplace As Range
Dim strToReplace1 As String
Dim strToReplace2 As String
Dim strReplaceWith As String
Dim cell As Variant
'Finner startcelle og sluttcelle
If ActiveCell.Value <> "" Then
rngStartCol = ActiveCell.End(xlToLeft).Column
rngEndCol = ActiveCell.End(xlToRight).Column
rngStartRow = ActiveCell.End(xlUp).Row
rngEndRow = ActiveCell.End(xlDown).Row
Else
MsgBox ("Blank cell chosen")
Exit Sub
End If
'''Velger range basert på ytterste celler
Set rngUsed = ActiveSheet.Range(Cells(rngStartRow, rngStartCol), Cells(rngEndRow, rngEndCol))
Set rngReplace = rngUsed
strToReplace1 = ">>"
strToReplace2 = "<<"
strReplaceWith = ""
For Each cell In rngReplace
If InStr(cell.Value, strToReplace1) > 0 Then
cell.Font.Bold = True
ElseIf InStr(cell.Value, strToReplace2) > 0 Then
cell.Font.Bold = True
End If
Next cell
rngReplace.Replace strToReplace1, strReplaceWith
rngReplace.Replace strToReplace2, strReplaceWith
End Sub