Results 1 to 5 of 5

Reset script error 13: types do not match

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-26-2017
    Location
    Brussels, Belgium
    MS-Off Ver
    2010
    Posts
    133

    Question Reset script error 13: types do not match

    When I click the reset button I made, the following script is activated:

    RESET SCRIPT:
    Sub Reset()
        
        If MsgBox("Bent u zeker dat u de ingevoerde data wil resetten...?", vbQuestion + vbYesNo + vbDefaultButton2, "Bevestigen") = vbYes Then
    With Sheets("Rapport")
        Range(.Cells(7, 4), .Cells(7, 9)).ClearContents
        Range(.Cells(8, 4), .Cells(8, 6)).ClearContents
        Range(.Cells(8, 8), .Cells(8, 9)).ClearContents
        Range(.Cells(9, 4), .Cells(9, 6)).ClearContents
        Range(.Cells(9, 8), .Cells(9, 9)).ClearContents
        Range(.Cells(10, 4), .Cells(10, 6)).ClearContents
        Range(.Cells(10, 8), .Cells(10, 9)).ClearContents
        Range(.Cells(15, 4), .Cells(15, 7)).ClearContents
        Range(.Cells(16, 4), .Cells(16, 5)).ClearContents
        Range(.Cells(16, 7), .Cells(16, 7)).ClearContents
        Range(.Cells(16, 8), .Cells(16, 9)).ClearContents
        Range(.Cells(17, 4), .Cells(17, 5)).ClearContents
        Range(.Cells(17, 7), .Cells(17, 7)).ClearContents
        Range(.Cells(17, 8), .Cells(17, 9)).ClearContents
        Range(.Cells(18, 4), .Cells(18, 5)).ClearContents
        Range(.Cells(18, 7), .Cells(18, 7)).ClearContents
        Range(.Cells(18, 8), .Cells(18, 9)).ClearContents
        Range(.Cells(19, 4), .Cells(19, 5)).ClearContents
        Range(.Cells(19, 7), .Cells(19, 7)).ClearContents
        Range(.Cells(19, 8), .Cells(19, 9)).ClearContents
        Range(.Cells(20, 4), .Cells(20, 5)).ClearContents
        Range(.Cells(20, 7), .Cells(20, 7)).ClearContents
        Range(.Cells(20, 8), .Cells(20, 9)).ClearContents
        Range(.Cells(25, 9), .Cells(25, 9)).ClearContents
        Range(.Cells(26, 9), .Cells(26, 9)).ClearContents
        Range(.Cells(27, 9), .Cells(27, 9)).ClearContents
        Range(.Cells(28, 9), .Cells(28, 9)).ClearContents
        Range(.Cells(34, 4), .Cells(34, 9)).ClearContents
        Range(.Cells(35, 4), .Cells(35, 9)).ClearContents
        Range(.Cells(36, 4), .Cells(36, 9)).ClearContents
        Range(.Cells(37, 4), .Cells(37, 9)).ClearContents
        Range(.Cells(38, 4), .Cells(38, 9)).ClearContents
        Range(.Cells(39, 4), .Cells(39, 9)).ClearContents
        Range(.Cells(42, 4), .Cells(42, 9)).ClearContents
        Range(.Cells(43, 4), .Cells(43, 9)).ClearContents
        Range(.Cells(30, 8), .Cells(30, 9)).ClearContents
    End With
        End If
    End Sub
    It gives me the following error:
    Error 13 during execution:
    Types do not match.


    When I look into the error it points to the following line from the 'Rapport' sheet code, the sheet in which the reset script is trying to reset fields:

    WORKSHEET SCRIPT:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim RResult As Range
        Set RResult = Range("H30")
        If Target.Address = "$H$17" Then
            Application.EnableEvents = False
            Range("D18:E18") = Worksheets("Keuzelijsten").Range("AA15")
            Application.EnableEvents = True
        End If
        If Not Intersect(Target, [H17]) Is Nothing Then
            Select Case Target.Value
                Case "Mechanische bevestiging", Sheets("Keuzelijsten").Range("I5").Value
                    With RResult
                        With .Validation
                            .Delete
                            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Isolatie"
                        End With
                        .Value = "1,2 x 0,6 m"
                    End With
                    
                Case Else
                    With RResult
                        .Validation.Delete
                        .Value = ""
                    End With
            End Select
        End If
    End Sub
    Basically, what this worksheet code does, is adding a dropdown to field H30 when H17 has a certain value.
    H17 is one of the fields that is reset by activating the reset button. There seems to be a conflict between these two codes.
    The reset script stops at field H17 although there are more fields to reset later in the script.

    Could anyone let me know what would be the appropriate way to solve this?
    Last edited by Solvax; 03-23-2018 at 09:54 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Problem with variable types in an index/match function
    By izzorac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-31-2014, 02:18 PM
  2. Data types cause #N/A Error
    By aikorei in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-12-2013, 06:20 PM
  3. [SOLVED] Script to recognise types of duplicate data
    By DMacSTB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-06-2012, 04:12 PM
  4. Find 2 types of value based on 3 match conditions
    By Elza in forum Excel General
    Replies: 9
    Last Post: 11-02-2012, 03:03 PM
  5. [SOLVED] How do I reset a for next loop in the script?
    By BrianATrease in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-18-2012, 12:22 PM
  6. How can I use this VB script to reset my values on other sheets?
    By trilogy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2006, 12:15 AM
  7. [SOLVED] Error types
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2005, 04: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