+ Reply to Thread
Results 1 to 7 of 7

Mismatch 13 and Nill Return Problem

  1. #1
    Registered User
    Join Date
    01-16-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Mismatch 13 and Nill Return Problem

    Hey Guys & Gals

    Long time reader, first time poster.

    I've got an input box that is suppose to delete an entire row based on the value entered in the box. Unfortunately, I've poached the code as it's beyond my ability to write it from scratch.

    It works great bar the fact I'm having two problems:

    1. When I press the cancel button on the input box, it return a type 13 mismatch.

    2. If I enter nothing or a number that does not exist and press ok, it just does some crazy loop and freezes excel.

    Sub DeleteDriver()
    Dim i As Integer
    i = InputBox("Please Enter a Driver Number to Delete")
    Range("A2").Select
    Do Until ActiveCell.Value = i
    ActiveCell.Offset(1, 0).Select
    Loop
    If ActiveCell.Value = False Then
    Exit Sub
    Else
    ActiveCell.EntireRow.Delete
    End If
    End Sub
    Any help for this vba dunce will be greatly appreciated.

    TIA

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Mismatch 13 and Nill Return Problem

    HI, elias1,

    maybe try
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    01-16-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Mismatch 13 and Nill Return Problem

    sorry, didn't work Holger. This one didn't delete a correct find either. And I understand this code even less than the original so I'm having problems working out what to do with it.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Mismatch 13 and Nill Return Problem

    Hi, elias1,

    could you please attach asample of the workbook where the code didnīt work? Did you make sure that no preceeding or trailing spaces are in the cell?

    I slightly altered the code and wrote a few notes about what the code is supposed to do:
    Please Login or Register  to view this content.
    Ciao,
    Holgher

  5. #5
    Registered User
    Join Date
    01-16-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Mismatch 13 and Nill Return Problem

    this is still not working for me. The original code that I have posted works exactly how I want it for the most part.

    I just need it to exit cleanly when you press cancel and allow for a user message to show if there is no matching number without crashing excel.

    sorry to be difficult, but I'm really struggling on this one.

  6. #6
    Registered User
    Join Date
    01-16-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Mismatch 13 and Nill Return Problem

    actually, the second code you put up works in that it cancels cleanly and doesn't crash if the number doesn't find a match, but it doesn't delete the row either. We're getting closer. I really appreciate everything that you are offering.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Mismatch 13 and Nill Return Problem

    Hi, elias1,

    We're getting closer.
    Maybre I got the idea from your description wrong but as long as I donīt get a copy of the workbook with your problem I wonīt spend any more time on it - itīs most surely just a very small bit thatīs missing but I canīt make it up from what I see.

    Ciao,
    Holger

+ 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] type mismatch problem
    By mira255 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2012, 06:56 AM
  2. type mismatch problem
    By hotmalepiyush in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2008, 08:50 AM
  3. Type mismatch problem
    By bernie1961 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2008, 01:20 PM
  4. Type mismatch problem
    By Dan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-31-2006, 12:00 PM
  5. Type Mismatch Problem
    By Damien McBain in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2005, 12: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