Sub insertvalues()
Dim rng As Range, cell As Range
Set rng = Range("A1:A" & Cells(Cells.Rows.Count, "a").End(xlUp).Row)
For Each cell In rng
If InStr(1, cell.Value, "Top", vbTextCompare) > 0 Then
cell.Offset(0, 1).Value = 1
ElseIf InStr(1, cell.Value, "Middle", vbTextCompare) > 0 Then
cell.Offset(0, 1).Value = 2
ElseIf InStr(1, cell.Value, "Bottom", vbTextCompare) > 0 Then
cell.Offset(0, 1).Value = 3
End If
Next cell
End Sub
|