+ Reply to Thread
Results 1 to 11 of 11

VBA .Find Function resulting in error message

  1. #1
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2013
    Posts
    129

    VBA .Find Function resulting in error message

    Hello,
    I have the following code that looks for a week number in the format of "Week n" and then moves to the correct cell;
    Please Login or Register  to view this content.
    However, when it gets to the code;
    Please Login or Register  to view this content.
    I get the error message "Run-time error '438': Object doesn't support this property or method".

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,238

    Re: VBA .Find Function resulting in error message

    Marc

    Where on sheet 'T&A' are the week numbers located?
    If posting code please use code tags, see here.

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,627

    Re: VBA .Find Function resulting in error message

    You need to set a Range for the Find function to search in.

    Also you do not set Week anywhere in your code previous to the search.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  4. #4
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: VBA .Find Function resulting in error message

    Unfortunetly I cannot unload the document which doesn't make this easy for you.
    I have taken a screen shot and attached which will hopefully help you.
    When I open the workbook, the VBA script searches for the current week and then moves to the cell directly under the 'Start' heading.
    Attached Images Attached Images

  5. #5
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: VBA .Find Function resulting in error message

    Thanks for the advice so far... I have changed the code slightly, I now have;
    Please Login or Register  to view this content.
    If I run through this code using 'F8', I get to the line
    Please Login or Register  to view this content.
    and I get the same error as mentioned above "Run-time error '438': Object doesn't support this property or method" but if I then run through it a second time it works fine, this pattern continues. It's weird and I can't work it out.

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2016 primarily
    Posts
    4,866

    Re: VBA .Find Function resulting in error message

    Do you have any SelectionChange event code in the worksheet? Do you have any references set to other object libraries in your code (e.g. Word)?
    Rory
    I drink, and I know things

  7. #7
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: VBA .Find Function resulting in error message

    rorya,
    This is my entire code for the wrokbook. It only has the one worksheet within it;
    Please Login or Register  to view this content.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    8,160

    Re: VBA .Find Function resulting in error message

    This does not look right...
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by sintek; 01-06-2020 at 08:51 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere.....
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember......Mark Thread as Solved.
    Excel Forum Rocks!!!

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    UK
    MS-Off Ver
    2016 primarily
    Posts
    4,866

    Re: VBA .Find Function resulting in error message

    And it's definitely a 438 error? If so, that makes no sense at all.

  10. #10
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: VBA .Find Function resulting in error message

    Thanks for all the help but I have now resoved the error using the code that sintek provided. Thanks again:-D

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    8,160

    Re: VBA .Find Function resulting in error message

    As per Rory Post 9, then your error could not have been 438...

    Thanks for rep +

+ 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] I can't find answer to Type Mismatch error message
    By j_Southern in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2019, 10:05 AM
  2. pop up message box and paste resulting value
    By secondchild12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2014, 02:47 PM
  3. Function Error Message
    By JayReina in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-11-2013, 05:17 PM
  4. Error Message For Function Procedure WITHOUT using a message box
    By bmr8002 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2012, 02:01 PM
  5. Error message on 4 IF formulas in one function
    By blondie1986 in forum Excel General
    Replies: 7
    Last Post: 01-17-2012, 05:34 AM
  6. How do I display an error message if Find Macro is unsuccessful
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-29-2008, 07:25 PM
  7. Find the Cell Reference Resulting from MAX function
    By Excel User in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-20-2005, 04:10 PM

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