Hi,
I have a code which searches for 2 values in a column and replaces value in rows in between those values. But i have many cobinations like this and the code works for only first , so i just want to loop untill last cell in excel.
My code is :
Sub Test()
Dim F1 As Range, F2 As Range
With ActiveSheet
Set F1 = .Columns("H").Find(What:="FIRST", LookIn:=xlValues, LookAt:=xlWhole)
Set F2 = .Columns("H").Find(What:="SECOND", LookIn:=xlValues, LookAt:=xlWhole)
If Not F1 Is Nothing And Not F2 Is Nothing Then ActiveSheet.Rows(F1.Row & ":" & F2.Row).Select
Selection.Replace What:="XG13", Replacement:="REPLACED", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="XG14", Replacement:="REPLACED", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End With
End Sub
Kindly help with this ,
Thanks & Regards ,
Mayur
Bookmarks