+ Reply to Thread
Results 1 to 12 of 12

Second Find is returning Type Mismatch "Run time error 13"

  1. #1
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Second Find is returning Type Mismatch "Run time error 13"

    The first Find below is returning a correct value, however the second Find is returning type mismatch "Run Time error 13"
    Any pointers as to what I'm doing wrong?

    Please Login or Register  to view this content.
    Ultimately I will be looping thru column B in the ws2 worksheet and for each match of the cell.value from wssheet worksheet i'll do some further processing
    Last edited by jprlimey; 05-22-2019 at 01:42 PM. Reason: Solved

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Second Find is returning Type Mismatch "Run time error 13"

    Might be this
    Please Login or Register  to view this content.
    Should be a colon separating the Bs.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Second Find is returning Type Mismatch "Run time error 13"

    The code does have a colon, I just mistyped in the post

    Please Login or Register  to view this content.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Second Find is returning Type Mismatch "Run time error 13"

    What is the '.....do something....' code doing?

    Far to many people resort to loops to do stuff that is more efficiently done with filtering.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Second Find is returning Type Mismatch "Run time error 13"

    The ..... do something........
    Are additional tasks that I will perform on the row that the second Find matches

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Second Find is returning Type Mismatch "Run time error 13"

    1) Your 2 sets of With/End with are there for nothing.

    2) Where did you set the reference to Rng1 in your code?
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Second Find is returning Type Mismatch "Run time error 13"

    Opps another mistype on my part

    Please Login or Register  to view this content.
    The mistypes were my efforts to clean up the code before posting

  8. #8
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Second Find is returning Type Mismatch "Run time error 13"

    Please Login or Register  to view this content.
    This is the culprit. Change to
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Second Find is returning Type Mismatch "Run time error 13"

    I’m assuming the (Rows.count, 1), is referring to column 1, where clearly I need column 2. Or is this just a wild guess on my part?

  10. #10
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Second Find is returning Type Mismatch "Run time error 13"

    You are correct. Since you are querrying column 2 it will give the type mismatch if you try to start in column 1.
    You can omit that parameter in the Find statement and let the default handle it unless you specifically want it to start at a certain cell when it begins the search.
    Last edited by JLGWhiz; 05-22-2019 at 08:37 AM.

  11. #11
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Re: Second Find is returning Type Mismatch "Run time error 13"

    JLGWhiz
    Thanks for you input it did help solve the problem, however it also revealed another issue in the second find.

    On the ws2 worksheet where we perform the 2nd Find routine we look for the cell.value returned by the 1st find routine which comes from wssheet worksheet. Now with the 2nd Find routine I want to collect information from adjacent cells on the same row where the 2nd Find locates a matching value. Then I planned on looking for the next matching value and again collect information from adjacent cells and repeat the Find etc. until no more matching records are found.

    To collected the information from adjacent cells I planned on simply using an offset from current cell, but it does appear to work.

    For example let's say the Apple was returned for the 1st Find, then we would Find the first occurrence of Apple in the 2nd Find, grab info from adjacent cells, then continue with the 2nd Find for next matching Apple and again grab info from adjacent cells, this would continue until all Apples have been processed at which time we would revert back to the 1st Find and process the next records for argument sake we will call that Pear. To aid with processing speed I did sort the dataset so that all Apples would be in consecutive rows.

    Please Login or Register  to view this content.

  12. #12
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Second Find is returning Type Mismatch "Run time error 13"

    If your first issue was resolved, then mark the thread as solved and start a new thread with the second issue, per forum guidelines. You probably wiil need to use the FindNext function to do what you want.
    Regards, JLG

+ 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. Type Mismatch error while using "Find" method
    By shiva_raj in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-01-2018, 08:59 PM
  2. Replies: 12
    Last Post: 11-24-2014, 10:22 AM
  3. Excel 2010 (Run-time error '13' type mismatch) "Debug" and "Continue" Grayed out.
    By Jeronimo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2012, 06:42 PM
  4. [SOLVED] How to fix "Run-time error 13, type mismatch" when vlookup return value of #N/A?
    By ohlalayeah in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2012, 02:01 AM
  5. [SOLVED] VBA Excel 2007 : Autofit Merge Cells Error "Run-time error '13': Type Mismatch"
    By Hudas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2012, 04:10 PM
  6. Getting "Type Mismatch" error on a Find operation
    By 6StringJazzer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2011, 07:01 PM
  7. Error Handling to mitigate "Run Time Erorr 13 Type Mismatch"
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2005, 09:05 AM

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