Backup your data.
Run: RandomFindAndReplace
Sub RandomFindAndReplace()
Dim nLastRow As Long, nRow As Long, nRandomRow As Long, str As String
Randomize 'Initialize the random number generator
'Find the last row in column "D"
nLastRow = Cells(Rows.Count, "D").End(xlUp).Row
' Start on row 13 to end
For nRow = 13 To nLastRow
'Random Row from 3 to 12
nRandomRow = CLng(10 * Rnd) + 3
str = Cells(nRandomRow, "E")
'Replace "[City]" with name in column "D"
str = Replace(str, "[City]", Cells(nRow, "D"))
'Place result in column "F"
Cells(nRow, "F") = str
Next nRow
End Sub
Bookmarks