+ Reply to Thread
Results 1 to 5 of 5

Mismatch error ?!

  1. #1
    Registered User
    Join Date
    09-21-2017
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    3

    Angry Mismatch error ?!

    I have code that copies all the files from different workbooks that start with a certain file name. The code below works great if ProjID is a String, however it falls apart when I make ProjID into a variant.

    Any help plz?

    Please Login or Register  to view this content.
    It stops here:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Mismatch error ?!

    I think it is good practice to force your code to declare all variables by using "Option Explicit"

    Please Login or Register  to view this content.
    Despite not declaring ProjID as object, you are treating like one. You can not compare and use like with object, it has to be a value, so you need to loop through range in the ProjID

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-21-2017
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    3

    Re: Mismatch error ?!

    I put this code together for one file name. Now I want it to run for a list on Column A; which is why I'm converting to a range now.
    How could I loop the loop?

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Mismatch error ?!

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-21-2017
    Location
    Washington, DC
    MS-Off Ver
    2010
    Posts
    3

    Re: Mismatch error ?!

    You Sir,

    ARE A GOD. THANK YOU! I've been beating myself up all weekend over this.

+ 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. Getting error message- Run-time error '13'; type mismatch
    By UPA in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2017, 03:43 AM
  2. [SOLVED] RunTime Error 13 ( type mismatch ) error is comming TextboxAfter_Update
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2017, 03:55 AM
  3. Run-time error 13 Type Mismatch/Error
    By thefinland in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-05-2016, 11:51 AM
  4. Type mismatch error- What is the reason behind the error message?
    By Endre111 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2014, 02:03 PM
  5. Complile Error: Type Mismatch ??? After adding error trap
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2012, 03:50 PM
  6. Conditional Formatting - Run Time Error '13' Type Mismatch Error
    By ksp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-17-2011, 07:37 PM
  7. Type Mismatch error & subscript out of range error
    By Jeff Wright in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2005, 03:06 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