+ Reply to Thread
Results 1 to 7 of 7

Run Time 13 Mismatch Error

  1. #1
    Forum Contributor
    Join Date
    02-21-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    122

    Run Time 13 Mismatch Error

    I am getting an error on this part ***If Month(w1.Range("B" & i)) = Month(Date) And w1.Range("C" & i) = 65 Then*** of the following code. It was running fine in excel 2007 and now I can't figure out what's wrong.

    The whole section of code is as follows............


    HTML Code: 
    Last edited by jscalem; 08-05-2014 at 03:03 PM.

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

    Re: Run Time 13 Mismatch Error

    Please wrap your code with code tags.
    W1 is not defined as object (Worksheet) while you are looping through lr.

  3. #3
    Forum Contributor
    Join Date
    02-21-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Run Time 13 Mismatch Error

    I did sorry I didn't do that in the first place.

    So to correct this would I just replace the w1 with the worksheet name??

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

    Re: Run Time 13 Mismatch Error

    And more

    If Month(w1.Range("B" & i)) = Month(Date) And w1.Range("C" & i) = 65 Then

    Which sheet name Month(Date) comes from? You need to reference the sheet name.
    Last, you have valid dates in column B.

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

    Re: Run Time 13 Mismatch Error

    Do you have any errors, or invalid dates in columns B or C?

    AB33

    Month is a VBA function, it returns the month of the date passed to it.
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor
    Join Date
    02-21-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Run Time 13 Mismatch Error

    Well the date is in the form of 20140805 the formula basically is copying over the lines in which the person turned 65 in the current month or 65 in the prior month. Column B is the date of birth and column C is the numerical age. I did not write that portion of code so I am a little unsure of how to fix the issue. I will check for errors in B or C though.

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

    Re: Run Time 13 Mismatch Error

    Norie,
    You are right! I was meant to say that the month should match to dates in column B.

+ 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. Run Time Error 13 Type mismatch Error
    By slohman in forum Excel General
    Replies: 1
    Last Post: 08-03-2014, 09:49 PM
  2. Run time error 13 Type mismatch error
    By baig123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-24-2014, 08:17 AM
  3. 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
  4. Run-time error '13' - Mismatch
    By Figboot in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-26-2011, 10:24 AM
  5. Run-Time error Value Mismatch
    By Simbo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2005, 06:01 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