
Option Explicit
Sub sostituisci()
Dim r As Range, parola As Variant, v As Variant, c As Range
Set r = Sheets("FRASI").Range("D2:D1000")
With Sheets("FRASI")
r.Value = .Range("B2:B1000").Value
For Each parola In Array("blue:blu", "yellow:rosso", "pipistrello:cavallo")
v = Split(parola, ":")
With r
Set c = .Find(v(0), LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
Do
c.Replace v(0), v(1)
Set c = .FindNext(c)
Loop While Not c Is Nothing
End If
End With
Next
.Range("C1").Select
End With
End Sub |
Sub sostituisci()
parola1 = "parola_da_cercare"
parola2 = "parola_da_scrivere"
For Each cel In Range("b2:b35")
If InStr(1, cel, parola1, vbTextCompare) <> 0 Then
Cells(cel.Row, 4) = parola2
End If
Next
End Sub
|
Option Explicit
Sub sostituisci()
Dim r As Range, parola As Variant, v As Variant, c As Range
Set r = Sheets("FRASI").Range("D2:D1000")
With Sheets("FRASI")
r.Value = .Range("B2:B1000").Value
For Each parola In Array("blue:blu", "yellow:rosso", "pipistrello:cavallo")
v = Split(parola, ":")
With r
Set c = .Find(v(0), LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
Do
c.Replace v(0), v(1)
Set c = .FindNext(c)
Loop While Not c Is Nothing
End If
End With
Next
.Range("C1").Select
End With
End Sub |
c.Replace v(0), v(1)
c = v(1)