I have this code which does a find and replace based on a criteria, all works fine except the last part. Here's the code,
[vba]
Sub Vacation_Trade_Xshift()
Dim x As Long, i As String
With Range("B6:H119")
For x = 122 To 139
If Range("C" & x) = 8 Then
.Replace What:=Range("B" & x), Replacement:=Range("J" & x), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If UCase(Range("I" & x)) = "TRADE" Then
.Replace What:=Range("E" & x), Replacement:=Range("H" & x), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If
If UCase(Range("I" & x)) = "XSHIFT" Then
i = Range("H" & x).Value
.Replace What:=Range("E" & x), Replacement:=Range("H" & x), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("E" & x).Value = i
End If
Next x
End With
Range("E122").Select
End Sub
[/vba]
If I122 = XSHIFT, Find E122 and H122 in the range B6:H119 and replace E122 with H122 and H122 with E122, Do until row 139 .