Results 1 to 6 of 6

Runtime Error 13 - Type Mismatch

Threaded View

  1. #1
    Registered User
    Join Date
    01-10-2017
    Location
    Wellington, New Zealand
    MS-Off Ver
    2010
    Posts
    15

    Exclamation Runtime Error 13 - Type Mismatch

    Hi,

    I am new to VBA and have been mashing together lines of code from different sites to get the result I need. It is rough.

    I think I have got it all working so far except for when I try and delete multiple items from one column (which are dropdown selections). The problem occurs only in this column and nowhere else. Everything is locked down so users can't see or adjust anything outside of what I have left open.

    Code is pasted below. Any help for this would be great!

    When I try delete 2 or more selections in one go from column AE the runtime error 13 appears. The thing this piece of code is achieving is a time stamp for when the status of work changes.

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        Dim rInt As Range
        Dim rCell As Range
        Dim tCell As Range
        
    
        Set rInt = Intersect(Target, Range("G4:G2503"))
        If Not rInt Is Nothing Then
            For Each rCell In rInt
                Set tCell = rCell.Offset(0, 37)
                If IsEmpty(tCell) Then
                ActiveSheet.Unprotect Password:="password"
                    tCell = Now
                    tCell.NumberFormat = "mm/dd/yy hh:mm AM/PM"
                ActiveSheet.Protect Password:="password", AllowFiltering:=True, AllowFormattingCells:=True
                End If
           
            Next
       
        End If
       
        
        With Target
         
            If .Column <> 31 Or .Row < 3 Then Exit Sub
            If .Value = "In Progress" Then
              ActiveSheet.Unprotect Password:="password"
                If .Offset(0, 14).Value = "" Then
                    .Offset(0, 14).NumberFormat = "mm/dd/yy hh:mm AM/PM"
                    .Offset(0, 14).Locked = True
                    .Offset(0, 14).Value = Now
                End If
                 ActiveSheet.Protect Password:="password", AllowFiltering:=True, AllowFormattingCells:=True
            ElseIf .Value = "Complete" Then
              ActiveSheet.Unprotect Password:="password"
                If .Offset(0, 15).Value = "" Then
                    .Offset(0, 15).NumberFormat = "mm/dd/yy hh:mm AM/PM"
                    .Offset(0, 15).Locked = True
                    .Offset(0, 15).Value = Now
                End If
                   ActiveSheet.Protect Password:="password", AllowFiltering:=True, AllowFormattingCells:=True
            ElseIf .Value = "Cancelled" Then
              ActiveSheet.Unprotect Password:="password"
                If .Offset(0, 16).Value = "" Then
                    .Offset(0, 16).NumberFormat = "mm/dd/yy hh:mm AM/PM"
                    .Offset(0, 16).Locked = True
                    .Offset(0, 16).Value = Now
                End If
                 ActiveSheet.Protect Password:="password", AllowFiltering:=True, AllowFormattingCells:=True
            ElseIf .Value = "On Hold" Then
              ActiveSheet.Unprotect Password:="password"
                If .Offset(0, 17).Value = "" Then
                    .Offset(0, 17).NumberFormat = "mm/dd/yy hh:mm AM/PM"
                    .Offset(0, 17).Locked = True
                    .Offset(0, 17).Value = Now
                End If
                ActiveSheet.Protect Password:="password", AllowFiltering:=True, AllowFormattingCells:=True
          End If
          
        End With
    ActiveSheet.Protect Password:="password", AllowFiltering:=True, AllowFormattingCells:=True
    End Sub
    Last edited by AliGW; 01-17-2017 at 02:05 AM. Reason: Code tags added.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Type Mismatch Runtime Error 13
    By EXCELBENCH in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-21-2015, 05:06 PM
  2. Runtime error 13 - type mismatch
    By Polluz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-29-2014, 11:30 PM
  3. Runtime error'13' - type mismatch
    By Polluz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2014, 01:12 PM
  4. RunTime Error 13: Type MIsmatch
    By tariq2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-24-2013, 10:47 AM
  5. Runtime Error 13 Type Mismatch
    By vtsoldier2010 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-30-2012, 12:59 PM
  6. Runtime error 13: Type mismatch
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2012, 10:06 AM
  7. runtime error 13 type mismatch
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2009, 11:15 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