Replace first and second occurrence with different characters

Viewed 1044

I have a vba code that does bulk replace.

I'd like to (etheir trough VBA or formula) replace first occurence of "%" with "(" and second occurence of "%" with ")" for each cell.

i have my data in column B.

This is my VBA code :

Sub Multi_FindReplace()

Dim sht As Worksheet
Dim fndList As Variant
Dim rplcList As Variant
Dim x As Long

fndList = Array("_", "VOSTFR.mp4", "VF.mp4")
rplcList = Array(" ", "VOSTFR", "VF")

'Loop through each item in Array lists
  For x = LBound(fndList) To UBound(fndList)
    'Loop through each worksheet in ActiveWorkbook
      For Each sht In ActiveWorkbook.Worksheets
        sht.Cells.Replace What:=fndList(x), Replacement:=rplcList(x), _
          LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
          SearchFormat:=False, ReplaceFormat:=False
      Next sht

  Next x

End Sub

Thanks ! :)

1 Answers
Related