+ Reply to Thread
Results 1 to 15 of 15

Debug error '13' - Type Mismatch

  1. #1
    Registered User
    Join Date
    08-02-2010
    Location
    Cyprus
    MS-Off Ver
    Excel 2007
    Posts
    12

    Debug error '13' - Type Mismatch

    Sorry for posting guys but I'm really stuck, I have this code that I borrowed and I had it working at some point, however I've not looked at it for a while and made some changes to the original spreadsheet it referenced, I've updated it to take into account those changes but now it comes up with an run type error '13' - Type Mismatch. When I click debug it highlights
    HTML Code: 
    This is the code in full:

    HTML Code: 
    Any help much appreciated!!!
    Last edited by Charlottewildsmith; 09-30-2010 at 02:47 PM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    re: Debug error '13' - Type Mismatch

    Hi,

    Do you still have dates in column J of your worksheet that are stored as text values?

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    08-02-2010
    Location
    Cyprus
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Debug error '13' - Type Mismatch

    First off Thanks for the Title change, explains it better!!

    Secondly I have dates in column J, formatted to show as dates, however just changed to show as text for a test run and still no joy.

  4. #4
    Registered User
    Join Date
    08-02-2010
    Location
    Cyprus
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Debug error '13' - Type Mismatch

    Oh and it does add the appointments to Outlook anyway. So it appears to run but with this error??

  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Debug error '13' - Type Mismatch

    I'm not sure what format Outlook expects the dates to be in when you create the appointment but DateValue is usually used for converting dates stored as strings to serial date values. If your dates are already serial dates in your worksheet you probably don't need to use it and may get errors.

    Dom

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Debug error '13' - Type Mismatch

    If your cells actually contain dates, then you shouldn't need the DateValue statement at all.
    Remember what the dormouse said
    Feed your head

  7. #7
    Registered User
    Join Date
    08-02-2010
    Location
    Cyprus
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Debug error '13' - Type Mismatch

    Yeah I'm not sure what outlook uses either, will do some more research on that, I've tried taking DateValue out before and whilst I had no errors it took the date of 30/10/2010 and put in in the calendar as Sat 30/12/1899, slight difference there!

    What's annoying is I'm sure I've had it running before, will do some more digging and once I have it sussed will post the answer (fingers crossed!)

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Debug error '13' - Type Mismatch

    I think .start must be a timeValue.

    e.g. if J3 is "12-03-2010 12:15:00"

    Please Login or Register  to view this content.
    Last edited by snb; 09-30-2010 at 12:43 PM.



  9. #9
    Registered User
    Join Date
    08-02-2010
    Location
    Cyprus
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Debug error '13' - Type Mismatch

    Ok I have checked it again without DateValue, now I am confused, it appears that the dates are getting entered as I wanted, however each time I run it 5 extra appointments are added with the date of 30/12/1899 and not sourcing any other information?? Ideas?? This is what I have entered in J, first line is blank followed by:


    DATE OF DEPARTURE
    30/10/2010
    31/10/2010
    01/11/2010
    02/11/2010
    03/11/2010
    04/11/2010
    05/11/2010
    06/11/2010
    07/11/2010
    08/11/2010
    09/11/2010
    10/11/2010
    11/11/2010
    12/11/2010

    I love code when it works!!

  10. #10
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Debug error '13' - Type Mismatch

    I suspect you are including 5 rows with blank cells in the start column.

  11. #11
    Registered User
    Join Date
    08-02-2010
    Location
    Cyprus
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Debug error '13' - Type Mismatch

    ahhhhh, now I thought like you did blank data at the start, so checked for hidden rows etc etc

    But I have the cells formatted so they are all pretty with 5 blank rows after my last row of data!! Seeing you write that made me recheck and "oh look 5 blank rows" just at the bottom and not the top. Hence the random appointments being added. Just need some code to stop it when it hits an empty cell.

    I can't thank you guys enough for helping me through this, I'm happy I was on the right track just with your input it made me take one step at a time.

  12. #12
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Debug error '13' - Type Mismatch

    Instead of using UsedRange to work out the last row try:

    Please Login or Register  to view this content.

    Dom

  13. #13
    Registered User
    Join Date
    08-02-2010
    Location
    Cyprus
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Debug error '13' - Type Mismatch

    THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU, THANK YOU!!!!!!!!

    I was just trying to work out what to do and if it was worth changing another code I have to format the cells as it added (not sure I'm up to that job at all yet!!) but this worked perfectly.

    Finished code is:

    HTML Code: 

  14. #14
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Debug error '13' - Type Mismatch

    Glad Dom got you sorted.

    Now for the boilerplate bit:

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  15. #15
    Registered User
    Join Date
    08-02-2010
    Location
    Cyprus
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Debug error '13' - Type Mismatch

    Yes Sir I have done it now hehehe

    Cheers guys

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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