+ Reply to Thread
Results 1 to 7 of 7

search for string stops after sheet 7

  1. #1
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    search for string stops after sheet 7

    hi, i have some code which searches through a document for a string.. but currently it stops after 7th page!

    why is this?


    thanks


    Please Login or Register  to view this content.
    Last edited by Jollyfrog; 11-02-2010 at 12:24 PM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: search for string stops after sheet 7

    what do you mean by stops?

    Without seeing the actual data your code in trying to process it's impossible to say.

    Have you stepped through your code to make sure all sheets are being processed and that the cell contents you are checking actually match.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: search for string stops after sheet 7

    hello,

    yes i have stepped through the code and it returns values correctly for the first few hundred iterations..

    when i run the code as a whole, the prgram seems to terminate, without errors or crashing, the giveaway is the ws.select line which basically highlights the last page where a match was found, this always seems to happen on page 7 out of about 30!


    Thanks

    Jonathan

  4. #4
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: search for string stops after sheet 7

    ok..

    after worksheet i added

    ws.select

    now it works,

    i'm guessing because it would lose foucus of the correct sheet after a match was found

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: search for string stops after sheet 7

    You find the problem before I could reply.

    You need to qualify fully the cells reference.
    So maybe your code should look more like

    Please Login or Register  to view this content.

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: search for string stops after sheet 7

    I think you'd better use advancedfilter



  7. #7
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: search for string stops after sheet 7

    ok, thanks

    i'll add that to the memory bank


    Jonathan

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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