+ Reply to Thread
Results 1 to 12 of 12

Macro Code - Run-time error'13':Type mismatch :(

  1. #1
    Forum Contributor
    Join Date
    06-09-2014
    Location
    Sweden
    Posts
    311

    Macro Code - Run-time error'13':Type mismatch :(

    Greeting to all

    I hav a "Macro Print Button" which can Print all Pages top to Down
    Except "Saturday & Sundays" pages

    but

    when ever i run the Macro Code it give Run-time error'13':
    Type mismatch
    and when i click on "Debug button" it highlight the following code " If Weekday(Cells(rw + 1, 10), vbMonday) < 6 Then"

    plz find the attachment
    Daily Attendance Staff.xlsm


    Your kind help will be highly appreciated

    High Regards

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

    Re: Macro Code - Run-time error'13':Type mismatch :(

    I run the code and I did not get any error.

  3. #3
    Forum Contributor
    Join Date
    06-09-2014
    Location
    Sweden
    Posts
    311

    Re: Macro Code - Run-time error'13':Type mismatch :(

    Quote Originally Posted by AB33 View Post
    I run the code and I did not get any error.
    if you change the month from the top row "Drop down Menu" and the run the cod it will give error

    regards

  4. #4
    Forum Contributor
    Join Date
    06-09-2014
    Location
    Sweden
    Posts
    311

    Re: Macro Code - Run-time error'13':Type mismatch :(

    Quote Originally Posted by AB33 View Post
    I run the code and I did not get any error.
    if you change the month from the top row "Drop down Menu" and the run the cod it will give error

    regards

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

    Re: Macro Code - Run-time error'13':Type mismatch :(

    I have changed E4 to September and run the code. No error!

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,030

    Re: Macro Code - Run-time error'13':Type mismatch :(

    Your code fails when the month selected is December. The Rw variable is 904. For other months, the Rw variable can have other values and, in some cases, more than one fail.

    The reason is that the formula in column J can return a blank: J905:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The formula "=DAY(J$875+1)" = 23

    The code below has been modified to give Debug output rather than try to print the data. If you comment out the Debug output and un-comment the Printout line, it should work and ignore the failures. I'm not going to do that because it creates too many pages of output (although I am printing to a PDF Printer).

    Regards, TMS


    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Forum Contributor
    Join Date
    06-09-2014
    Location
    Sweden
    Posts
    311

    Re: Macro Code - Run-time error'13':Type mismatch :(

    Thnks "TMS"

    at-last some one has figure out the error in the code

    can you plz upload the excel file with your Code bcz it not working when i past the code in my excel sheet

    Best Regards

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,030

    Re: Macro Code - Run-time error'13':Type mismatch :(

    Please see the attached updated workbook. I have slightly modified the code to display "(blank)" if the cell is blank.

    I have copied the output from the Immediate Window to Sheet2 (just for the months with one or more errors.

    Regards, TMS
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    06-09-2014
    Location
    Sweden
    Posts
    311

    Re: Macro Code - Run-time error'13':Type mismatch :(

    thnks for the file

    but when i click on the Macro print button in sheet 1 it do not send prints

    best Regards

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,030

    Re: Macro Code - Run-time error'13':Type mismatch :(

    It is not set up to print. It is producing diagnostic output. You need to remove the comment from the PrintOut statement. And you can comment out the diagnostics.

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    06-09-2014
    Location
    Sweden
    Posts
    311

    Re: Macro Code - Run-time error'13':Type mismatch :(

    working great
    Thanks so much for taking the time out to help me out from this problem..

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,030

    Re: Macro Code - Run-time error'13':Type mismatch :(

    You're welcome. Thanks for the 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] Sudden appearance of Run-time error '13': Type mismatch in previously working code
    By Rhudi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-22-2014, 11:30 PM
  2. Filing Macro - Run time error '13: Type Mismatch
    By WillJ in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-12-2014, 07:44 AM
  3. VBA Code Run-time Error 13 - Type mismatch
    By jmancha in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-16-2013, 11:15 AM
  4. Re: Help with a macro- 'Run-Time error '13' Type Mismatch
    By pman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-16-2012, 03:31 PM
  5. Macro gives Run-time error '13': Type mismatch, but nothing has changed?
    By BlondOIverBlue in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-10-2010, 11:52 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