Results 1 to 6 of 6

Loop the code untill end

Threaded View

  1. #1
    Registered User
    Join Date
    02-29-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    41

    Loop the code untill end

    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
    Last edited by jeffreybrown; 07-12-2013 at 05:00 PM. Reason: Added code tags...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1