+ Reply to Thread
Results 1 to 9 of 9

Error Type 13 when running a macro

  1. #1
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Error Type 13 when running a macro

    I have a workbook("Adherence Macro") that I created and when i move it from the folder where I created it, it throws the error "Run-time error '13': Type mismatch. I have included my workbook and the code to see if anyone can assist! Thank you very much in advance!
    Please Login or Register  to view this content.
    This is where it is throwing the error:
    Please Login or Register  to view this content.
    Basically this is supposed to import data from my agents sheets which each one has their own workbook as their name - like I stated when the workbook was where I created it, the macro ran fine and didnt have any problems, but once I move the file to a different folder that is when I start having trouble.
    Attached Files Attached Files

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

    Re: Error Type 13 when running a macro

    Please Login or Register  to view this content.
    This line searches for your agents files in the same directory as your Adherence workbook.

    If you change this to the path where your agents files are it should be working again.
    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.

  3. #3
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Error Type 13 when running a macro

    Well they are still in the same folder, I just moved that folder to a new area and that is when it throws the error. I change LR as Long to LR as Variant and it puts the error down to the line
    Please Login or Register  to view this content.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Error Type 13 when running a macro

    If the data in the sheet is not sorted, or has no numbers in column A, then the Match formula will return an error value, and that will cause a mismatch.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  5. #5
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Error Type 13 when running a macro

    Column A starts with row 9 with dates in them - do you know what will need to change for that to happen correctly?

  6. #6
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Error Type 13 when running a macro

    I have updated the code to this:
    Please Login or Register  to view this content.
    I am showing that myMax = 1 & LR = 0 which is still throwing the error on this line:
    Please Login or Register  to view this content.
    Any help would be greatly appreciated! I have also included a sample workbook of my "Adherence Macro" workbook & one of the agents workbook "Eva Yates" to help you better understand!
    Attached Files Attached Files

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

    Re: Error Type 13 when running a macro

    Quote Originally Posted by Jamesraywebber85 View Post
    I have updated the code to this:
    https://www.excelforum.com/excel-pro...ml#post4898038

  8. #8
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Error Type 13 when running a macro

    Based off what I found is there an error in the way the LR is written. See example of what I found to further assist & as always thank you in advance for all your help!

    This is where the person was getting an error in this code:
    Please Login or Register  to view this content.
    This is the solution to fix the error (mismatch 13)
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Error Type 13 when running a macro

    Any ideas?

+ 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. HELP - Type Mismatch Error when running Solver from VBA code
    By HelloExcelPros in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-08-2015, 12:41 PM
  2. Getting Error "13 Type Mismatch" when running ActiveSheet.Querytables
    By bconner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2014, 12:50 PM
  3. Runtime Error 13 - Type Mismatch while running Macro
    By rrajnish in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2013, 02:01 PM
  4. [SOLVED] run time error 13 type mismatch when running VB macro in Excel 97
    By bkwins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2013, 04:41 AM
  5. [SOLVED] "Run-time error '13': type mismatch when running macro to add text to end of text
    By nrjordan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2012, 10:34 PM
  6. Cannot find macro error when running a macro from a macro in a diffrent workbook.
    By Acrobatic82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 09:22 AM
  7. [SOLVED] Type Mismatch Error when running a SELECT SQL
    By Andy Dorph in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2005, 03:06 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