+ Reply to Thread
Results 1 to 4 of 4

Runtime Error 91 on macro Find... Any suggestions? =)

  1. #1
    Registered User
    Join Date
    05-29-2014
    Location
    Perth
    MS-Off Ver
    Office 2007 Professional
    Posts
    2

    Runtime Error 91 on macro Find... Any suggestions? =)

    Hi Everyone,

    I'm doing a job on geological data. There are many tab delineated text files that I wish to process in order to make them easier for me to put into a database.
    I've written a macro in excel that arranges the tab delineated text files into several sheets in a workbook.

    This macro was written so far using combination of the record macro option, adding code from the help dialogues and trial and error in order to custom my Macro. I had managed to get my macro working with one of my worksheets without any error. Then, I started using different files to test it out and then discovered the runtime error 91 here in the Debugger.
    I tried to fix the Macro code with some short lived success and now it won't even work on my original text file because of the RunTimeError91.

    In my Macro the offending code is this:
    Please Login or Register  to view this content.
    For some reason, the Debugger will give me a Runtime Error 91 and then sometimes not.
    I have help checked it. I am unsure as to what Object I haven't defined, plus I haven't used any With statements in my Sub code.

    This is the main Code here...
    Please Login or Register  to view this content.
    Here is an image of the worksheets that I'm working with:
    datafile to split.PNG

    Essentially, I just want the Cells.Find part of my Macro to be able to find the H1000 Cell and the first D Cell in the Worksheet without giving an error.

    I hope that someone can help here. I offer much gratitude and good vibes to anybody who can.

    Thankyou ExcelForum,
    Sator

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    The problem is that Find isn't finding what you are looking for.

    When that happens it returns Nothing.

    Is ' H1000' definitely on the active sheet when you run the code?
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Runtime Error 91 on macro Find... Any suggestions? =)

    Is the H1000 definately there, as the error could be nothing found, so no row selected...
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  4. #4
    Registered User
    Join Date
    05-29-2014
    Location
    Perth
    MS-Off Ver
    Office 2007 Professional
    Posts
    2

    Re: Runtime Error 91 on macro Find... Any suggestions? =)

    Thanks Norie and nathansav!

    I have since cancelled all of the other functions and it seems to work so I realise I need to make the sheet Active when I run the Find.
    Now I realise why I am getting a object error.
    Kind Thanks!

    Sator

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Runtime error 9 - can't find the problem
    By Ottoman079 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-25-2013, 09:13 AM
  2. [SOLVED] FIND function returns Runtime Error 91 in VBA
    By Ivkosky in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-25-2012, 05:08 PM
  3. VBA vlookup won't find numbers - runtime error 1004
    By wonderdunder in forum Excel General
    Replies: 9
    Last Post: 05-26-2011, 04:53 PM
  4. Runtime Error 91 on Cells.Find
    By NickS89 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-31-2011, 01:26 PM
  5. Runtime error 3024 could not find file
    By vbqueen in forum Access Tables & Databases
    Replies: 2
    Last Post: 09-14-2010, 10:46 PM

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