Results 1 to 14 of 14

Stop Macro From Falling Over

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Stop Macro From Falling Over

    This macro works fine but falls over when it can't find a match can anyone advise how I can get around that please? I have highlighted in bold

    Thanks

    Sub Test()
    Dim Alpha
    Dim Alpha1
    Dim Bravo
    Dim CopyData
    Dim RowNo
    
        Windows("MASTER_SCHEDULE.XLS").Activate
        Alpha = ActiveWorkbook.Name
        Sheets("Master").Select
        Range("X5").Select
        Alpha1 = ActiveCell.Value
        CopyData = ActiveCell.Offset(0, -1).Value
        
        'Range(ActiveCell, ActiveCell.Offset(0, -1)).Copy
      
        Windows("FW_KP 2011 TITLES_190911 VS1.XLS").Activate
        Bravo = ActiveWorkbook.Name
        Sheets("Link To Cinc").Activate
        Range("A:A").Select
        
        Selection.Find(What:=Alpha1, After:=ActiveCell, LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False).Activate
        
        ActiveCell.Offset(0, 2).Range("A1") = CopyData
        RowNo = 1
        
        Do Until Finish = True
        Windows(Alpha).Activate
        CopyData = ActiveCell.Offset(RowNo, -1).Value
        Alpha1 = ActiveCell.Offset(RowNo, 0).Value
        Windows(Bravo).Activate
        
        Selection.Find(What:=Alpha1, After:=ActiveCell, LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False).Activate
        
        ActiveCell.Offset(0, 2).Range("A1") = CopyData
        RowNo = RowNo + 1
        If Alpha1 = "" Then Finish = True
        Loop
    End Sub
    Last edited by timbo1957; 10-13-2011 at 10:46 AM.

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