+ Reply to Thread
Results 1 to 4 of 4

Error Message: Run-time 13, Type Mismatch

  1. #1
    Registered User
    Join Date
    02-26-2015
    Location
    RSA
    MS-Off Ver
    2010
    Posts
    29

    Error Message: Run-time 13, Type Mismatch

    I have a macro than manages a dynamic drop down list from a input table. When I delete one input value at a time, no error message. But when I delete a range of inputs at once the attached error message pops up. By clicking "End" one can continue to work, but I do not want to see the message. Do I need to add more code for this occurrence?

    Code:

    Private Sub Worksheet_Change(ByVal Target As Range)

    ' $D$30 is the Company Dropdown
    ' $E$30 is the Product Dropdown
    ' $F$30 is the Range Dropdown

    If Intersect(Target, Range("$D$30:$G$64")) Is Nothing Then Exit Sub

    If Target.Value <> "" Then

    Select Case Left(Target.Address, 2)

    Case "$D" ' The company dropdown is changed
    Worksheets("Dropdown").Range("$D$1") = Target.Value ' Set the filter on the company pivot table
    Worksheets("Dropdown").Range("$G$1") = Target.Value
    Worksheets("Dropdown").Range("$J$1") = Target.Value

    Case "$E" ' The product dropdown is changed
    Worksheets("Dropdown").Range("$G$2") = Target.Value ' Set the filter on the product pivot table
    Worksheets("Dropdown").Range("$J$2") = Target.Value

    Case "$F" ' The range dropdown is changed
    Worksheets("Dropdown").Range("$J$3") = Target.Value ' Set the filter on the range pivot table

    Case "$G"
    If Cells(Target.Row, "R") <> "" Then
    MsgBox Cells(Target.Row, "R").Value
    End If

    End Select

    End If

    End Sub
    Attached Images Attached Images
    Last edited by slabs; 08-12-2016 at 09:57 AM.

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Error Message: Run-time 13, Type Mismatch

    Hello
    You can try adding and extra statement to your opening IF:

    Please Login or Register  to view this content.
    This should prevent the error when the Target has more than 1 cell selected.

    DBY

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Error Message: Run-time 13, Type Mismatch

    This will loop through the selected cells within $D$30:$G$64 (not tested)

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    02-26-2015
    Location
    RSA
    MS-Off Ver
    2010
    Posts
    29

    Re: Error Message: Run-time 13, Type Mismatch

    Thanks!! Tried first solution from DBY and it works

+ 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. Type mismatch error- What is the reason behind the error message?
    By Endre111 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2014, 02:03 PM
  2. [SOLVED] Run Time Error 13 . Type mismatch
    By TERRI LEE in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-09-2014, 03:24 PM
  3. Run Time error 13 : Type Mismatch
    By sugaprasad in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-11-2013, 02:06 PM
  4. Run-Time Error '13: Type Mismatch
    By mlegge77 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2013, 04:44 PM
  5. run-time error '13' type mismatch
    By dp1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-06-2012, 02:43 AM
  6. Run-Time error 13: type Mismatch Help!
    By Fellhouse in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2011, 04:58 PM
  7. Run Time Error '13':Type Mismatch
    By rms099k in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2008, 03:37 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