+ Reply to Thread
Results 1 to 16 of 16

VBA Run-time error '91' In Excel 2013

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Run-time error '91' In Excel 2013

    Hi, I wonder whether someone may be able to help me please.

    I made the following post on this forum earlier in the week.

    http://www.excelforum.com/excel-prog...11#post3400811

    As you can see, I was really very fortunate that @jaslake was very kind enough to provide a solution for this. However, unfortunately, as you will also see, I'm having trouble in running the code, because when doing so, I receive the following error:
    Run-time error '91' object variable or With variable not set
    What is even more perplexing, is that @jaslake has no problems at all.

    I'm clearly doing something wrong, perhaps in the way I've set up my version of Excel, but I just thought I'd pass this out to a wider audience, to see if someone may be able to offer a solution which may help in me being able to run the script.

    Many thanks and kind regards

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Run-time error '91' In Excel 2013

    your column widths are too small to display the date text so the find fails. at the beginning of the extract_detail routine below these lines
    Please Login or Register  to view this content.
    add these
    Please Login or Register  to view this content.
    then try the code again
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Run-time error '91' In Excel 2013

    Hi @JosephP, thank you very much for taking the time to reply to my post.

    I've amended the code you suggested, but unfortunately I'm still receiving the same error. My apologies.

    Kind Regards

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Run-time error '91' In Excel 2013

    interesting-I had the same error as you before adding those lines but the code was fine thereafter. which line is flagged as the error line?

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Run-time error '91' In Excel 2013

    Hi @JosephP, thank you very much for coming back tome so quickly with this, and I'm sorry to be a burden.

    The line which I receive the error from is line 104.

    Many thanks and kind regards

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Run-time error '91' In Excel 2013

    since you don't have line numbers in your code can you tell me what the line actually says? ;-)

  7. #7
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Run-time error '91' In Excel 2013

    Hi @JosephP, my apologies, I took the line number from the VBA debug screen.

    The line which I receive the error from:
    Please Login or Register  to view this content.
    Many thanks and kind regards

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Run-time error '91' In Excel 2013

    what's the line before it?

  9. #9
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Run-time error '91' In Excel 2013

    Hi, the line before the aforementioned is this:
    Please Login or Register  to view this content.
    Many thanks and kind regards

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Run-time error '91' In Excel 2013

    can you post your file with my additional code in it so I can test it?

  11. #11
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Run-time error '91' In Excel 2013

    Hi, please find the file attached below.

    Many thanks and kind regards
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Run-time error '91' In Excel 2013

    Hi @JosephP, I'm very sorry to trouble you, but I noticed a copy and paste error on the "Projects Output" sheet, my apologies.

    Please find the revised correct file attached.

    Many thanks and kind regards
    Attached Files Attached Files

  13. #13
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Run-time error '91' In Excel 2013

    there are no date headers in row 4 on the Project Output sheet-unlike your original sample-which is why the code fails

  14. #14
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Run-time error '91' In Excel 2013

    Hi @JosephP, thank you very much for coming back to me with this.

    I've just looked at the latest file I uploaded and this does contain date headers in row 4 on the "Projects Output" sheet, so I'm a little confused.

    Many thanks and kind regards

  15. #15
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: VBA Run-time error '91' In Excel 2013

    what I mean is that when the code runs there are no headers
    Please Login or Register  to view this content.
    because there is no data in the projects output sheet, lrP becomes 4 and you end up clearing the headers so the later Find operation fails. perhaps use
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Run-time error '91' In Excel 2013

    Hi @JosephP, thank you for coming back to me with this and my apologies for not grasping your explanation. I've tried the code you kindly provided, but unfortunately I'm still receiving the same error.

    I think I may have to go back to the 'drawing board' with this, so please don't spend anymore time on this.

    Thank you for all your time, trouble and patience.

    Kind Regards

+ 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. excel 2013 32bit error
    By ggomez43 in forum Excel General
    Replies: 0
    Last Post: 08-22-2013, 03:20 PM
  2. Type mismatch Error observer in Excel 2013
    By mechbhaskar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2013, 07:50 AM
  3. Functions not recognized (error) in Excel 2013 64bit,
    By PlamenGo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-24-2013, 05:36 AM
  4. [SOLVED] VBA error in excel 2013
    By zepp in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-26-2013, 02:47 AM
  5. [SOLVED] Date and Time issues in Excel 2013
    By sjsmith in forum Excel General
    Replies: 1
    Last Post: 01-15-2013, 03:28 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