+ Reply to Thread
Results 1 to 5 of 5

Works beautifully but stops half way through

  1. #1
    kimbroughton@westvirginia.com
    Guest

    Works beautifully but stops half way through

    Hi,
    I found this script in this group and changed it to my parameters. It
    is finding a 10 line by 2 column wide header on the top of every page
    of a file I imported and removing it. It works great but for some
    reason it stops on line 32785. There are 54733 lines in the file. I
    was hoping someone could review the code and see if you can tell why it
    is stopping here.
    Thanks!
    Kim

    Sub DeleteHeaders()

    Dim intCurRow As Integer
    Columns("A:A").Select
    On Error GoTo jump1:
    Do
    Cells.Find(What:="STAT", After:=ActiveCell,
    LookIn:=xlFormulas, Lookat _
    :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
    MatchCase:= _
    True, SearchFormat:=False).Activate
    intCurRow = ActiveCell.Row
    ActiveCell.Range("A1:B10").Select
    Selection.EntireRow.Delete
    Loop
    jump1:

    End Sub


  2. #2
    Zone
    Guest

    Re: Works beautifully but stops half way through

    You should dim your CurRow variable as Long. Haven't tested that, but
    should do it.
    James
    kimbroughton@westvirginia.com wrote:
    > Hi,
    > I found this script in this group and changed it to my parameters. It
    > is finding a 10 line by 2 column wide header on the top of every page
    > of a file I imported and removing it. It works great but for some
    > reason it stops on line 32785. There are 54733 lines in the file. I
    > was hoping someone could review the code and see if you can tell why it
    > is stopping here.
    > Thanks!
    > Kim
    >
    > Sub DeleteHeaders()
    >
    > Dim intCurRow As Integer
    > Columns("A:A").Select
    > On Error GoTo jump1:
    > Do
    > Cells.Find(What:="STAT", After:=ActiveCell,
    > LookIn:=xlFormulas, Lookat _
    > :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
    > MatchCase:= _
    > True, SearchFormat:=False).Activate
    > intCurRow = ActiveCell.Row
    > ActiveCell.Range("A1:B10").Select
    > Selection.EntireRow.Delete
    > Loop
    > jump1:
    >
    > End Sub



  3. #3
    kimbroughton@westvirginia.com
    Guest

    Re: Works beautifully but stops half way through

    That did it!!!!
    Thank you

    Zone wrote:
    > You should dim your CurRow variable as Long. Haven't tested that, but
    > should do it.
    > James
    > kimbroughton@westvirginia.com wrote:
    > > Hi,
    > > I found this script in this group and changed it to my parameters. It
    > > is finding a 10 line by 2 column wide header on the top of every page
    > > of a file I imported and removing it. It works great but for some
    > > reason it stops on line 32785. There are 54733 lines in the file. I
    > > was hoping someone could review the code and see if you can tell why it
    > > is stopping here.
    > > Thanks!
    > > Kim
    > >
    > > Sub DeleteHeaders()
    > >
    > > Dim intCurRow As Integer
    > > Columns("A:A").Select
    > > On Error GoTo jump1:
    > > Do
    > > Cells.Find(What:="STAT", After:=ActiveCell,
    > > LookIn:=xlFormulas, Lookat _
    > > :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
    > > MatchCase:= _
    > > True, SearchFormat:=False).Activate
    > > intCurRow = ActiveCell.Row
    > > ActiveCell.Range("A1:B10").Select
    > > Selection.EntireRow.Delete
    > > Loop
    > > jump1:
    > >
    > > End Sub



  4. #4
    Tom Ogilvy
    Guest

    Re: Works beautifully but stops half way through

    You also had an answer to your earlier post.

    --
    Regards,
    Tom Ogilvy


    "kimbroughton@westvirginia.com" wrote:

    > That did it!!!!
    > Thank you
    >
    > Zone wrote:
    > > You should dim your CurRow variable as Long. Haven't tested that, but
    > > should do it.
    > > James
    > > kimbroughton@westvirginia.com wrote:
    > > > Hi,
    > > > I found this script in this group and changed it to my parameters. It
    > > > is finding a 10 line by 2 column wide header on the top of every page
    > > > of a file I imported and removing it. It works great but for some
    > > > reason it stops on line 32785. There are 54733 lines in the file. I
    > > > was hoping someone could review the code and see if you can tell why it
    > > > is stopping here.
    > > > Thanks!
    > > > Kim
    > > >
    > > > Sub DeleteHeaders()
    > > >
    > > > Dim intCurRow As Integer
    > > > Columns("A:A").Select
    > > > On Error GoTo jump1:
    > > > Do
    > > > Cells.Find(What:="STAT", After:=ActiveCell,
    > > > LookIn:=xlFormulas, Lookat _
    > > > :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
    > > > MatchCase:= _
    > > > True, SearchFormat:=False).Activate
    > > > intCurRow = ActiveCell.Row
    > > > ActiveCell.Range("A1:B10").Select
    > > > Selection.EntireRow.Delete
    > > > Loop
    > > > jump1:
    > > >
    > > > End Sub

    >
    >


  5. #5
    kimbroughton@westvirginia.com
    Guest

    Re: Works beautifully but stops half way through

    Thanks Tom,
    I deleted that after I found the code but it still seems to be around.
    I think the code I used that worked I found in a post you supplied
    awhile ago. That's funny.
    Thanks!
    Kim

    Tom Ogilvy wrote:
    > You also had an answer to your earlier post.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "kimbroughton@westvirginia.com" wrote:
    >
    > > That did it!!!!
    > > Thank you
    > >
    > > Zone wrote:
    > > > You should dim your CurRow variable as Long. Haven't tested that, but
    > > > should do it.
    > > > James
    > > > kimbroughton@westvirginia.com wrote:
    > > > > Hi,
    > > > > I found this script in this group and changed it to my parameters. It
    > > > > is finding a 10 line by 2 column wide header on the top of every page
    > > > > of a file I imported and removing it. It works great but for some
    > > > > reason it stops on line 32785. There are 54733 lines in the file. I
    > > > > was hoping someone could review the code and see if you can tell why it
    > > > > is stopping here.
    > > > > Thanks!
    > > > > Kim
    > > > >
    > > > > Sub DeleteHeaders()
    > > > >
    > > > > Dim intCurRow As Integer
    > > > > Columns("A:A").Select
    > > > > On Error GoTo jump1:
    > > > > Do
    > > > > Cells.Find(What:="STAT", After:=ActiveCell,
    > > > > LookIn:=xlFormulas, Lookat _
    > > > > :=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
    > > > > MatchCase:= _
    > > > > True, SearchFormat:=False).Activate
    > > > > intCurRow = ActiveCell.Row
    > > > > ActiveCell.Range("A1:B10").Select
    > > > > Selection.EntireRow.Delete
    > > > > Loop
    > > > > jump1:
    > > > >
    > > > > End Sub

    > >
    > >



+ Reply to Thread

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