+ Reply to Thread
Results 1 to 14 of 14

Type Mismatch Error 13.

  1. #1
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Type Mismatch Error 13.

    Hi All,
    I have been banging my head against a wall with this one. The script works fine but I still get the type mismatch error. I have looked up solutions to this issue with adding Val and .Value and IsNumeric but to no avail. I need the error to go away as when it goes to the user i can't have error messages popping up.
    Here is the script;
    Please Login or Register  to view this content.
    Any help would be great!!

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Type Mismatch Error 13.

    Hi beenbee,

    It's very hard to pinpoint the problem as you don't say what line(s) is erring out and without the wbookmark macros we cannot run the function in its entirety.

    That said, try inserting this line...

    Please Login or Register  to view this content.
    ...immediately beneath this line:

    Please Login or Register  to view this content.
    and add another End If to complete the statement.

    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: Type Mismatch Error 13.

    Sorry, the line that is having the issue is;
    Please Login or Register  to view this content.
    I have added the workbook. The code in question is in module 1.
    Thanks for the help.
    Attached Files Attached Files
    Last edited by beenbee; 02-25-2014 at 06:10 AM.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Type Mismatch Error 13.

    There's no attachment

  5. #5
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: Type Mismatch Error 13.

    Sorry they are there if I go to edit the post but don't show up when I post. Trying again ........
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Type Mismatch Error 13.

    The code is getting caught after the last entry in Col I (I17 in the posted example) because after this it finding the next entry in the column which is text i.e. "Total No Items: " in cell I36 via the bolded part of this statement:

    Please Login or Register  to view this content.
    If you know the last row to be 35 use that instead of effectively pressing Shift + End + Down Arrow

    HTH

    Robert

  7. #7
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: Type Mismatch Error 13.

    I'm not sure what you mean. Also not sure if that is the issue as when I move the "Total No Items" & "Total Pallets" out of column I and into J, it still throws the type mismatch error out. Also my For statement sets the range "I16:I35" doesn't that stop it from going any further?

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Type Mismatch Error 13.

    Also not sure if that is the issue as when I move the "Total No Items" & "Total Pallets" out of column I and into J, it still throws the type mismatch error out.
    Yes, it's the same issue. After moving the text lines to Col. J, the range after the second value (i.e. I17) is I18:I65536 which as it's full of blank cells creates the same error message.

    Also my For statement sets the range "I16:I35" doesn't that stop it from going any further?
    No, because the line I pointed out in post 6 is the same as pressing Shift + End + Down Arrow from the aCell cell location. Try it - goto cell I17 press and hold the Shift key and then press the End key and finally press the Down Arrow key.

    What are you trying to achieve with the code in post 6 and do you really have to create the document in Word (would save a lot of code if you just did it in the workbook)?
    Last edited by Trebor76; 02-25-2014 at 07:14 AM.

  9. #9
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: Type Mismatch Error 13.

    ah, yes I see. What I'm trying to achieve is; If I16 has a value of 1 I want it to then move down to the next cell in range (I17) and check the value, if it is 1 then I want the code to take the row number and use it in the sub wbookmark3 which populates bookmarks in word.

  10. #10
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Type Mismatch Error 13.

    What do want to do when aCell = I17?

  11. #11
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: Type Mismatch Error 13.

    Set I17 as dCell.

  12. #12
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Type Mismatch Error 13.

    Still not sure how it's meant to fit together or why you want to do it in Word, but try this:

    Please Login or Register  to view this content.
    Robert
    Last edited by Trebor76; 02-25-2014 at 08:01 AM.

  13. #13
    Forum Contributor
    Join Date
    10-07-2013
    Location
    Wilts, England
    MS-Off Ver
    Excel 2013
    Posts
    100

    Re: Type Mismatch Error 13.

    I want to do it in word as I want the pallet markers to be printed onto sticky labels so it easiest to set the template up in word (or so I thought, is this not the case?).
    I had a huge 1000line code I wrote which was doing what I have the code doing now. I ask'd for help to condense it, but no one answered.
    Thank you for your help. That seems to have sorted the issue.

  14. #14
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Type Mismatch Error 13.

    Having the template in Excel will do away with all the code you have opening the Word template and linking the cells via bookmarks.

    Since we've got it working, you might as well leave it. If you could mark the thread as solved it would be appreciated.

    Regards,

    Robert

+ 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 Type error 13 Type Mismatch
    By Affan Khan in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-13-2012, 12:58 PM
  2. [SOLVED] Run-type error 13 type mismatch
    By misop in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-05-2012, 04:08 AM
  3. 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
  4. 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
  5. [SOLVED] Help: Compile error: type mismatch: array or user defined type expected
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2005, 05:05 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