+ Reply to Thread
Results 1 to 2 of 2

Type Mismatch Run Time Error with Code when deleting multiple cells contents

  1. #1
    Registered User
    Join Date
    01-22-2016
    Location
    Leicester, England
    MS-Off Ver
    2013
    Posts
    12

    Type Mismatch Run Time Error with Code when deleting multiple cells contents

    Hi all,

    I've been using the below code to automatically enter today's date in column b when entering anything into column a - which has been working perfectly.

    Private Sub Worksheet_Change(ByVal Target As Range)
    ' If you update a cell in column A with a value and there is no date in the corresponding row of column B then
    If Not Intersect(Target, Range("A:A")) Is Nothing And Target.Value <> "" And Range("B" & Target.Row).Value = "" Then
    ' Insert today's date in the corresponding row of column B
    Range("B" & Target.Row).Value = Date
    ' Else if you remove the value from a cell in column A then
    ElseIf Not Intersect(Target, Range("A:A")) Is Nothing And Target.Value = "" And Range("B" & Target.Row).Value <> "" Then
    ' Clear the value from the corresponding row of column B
    Range("B" & Target.Row).ClearContents
    End If
    End Sub


    However, I've just noticed that when I delete the contents of multiple cells at one time anywhere in the worksheet I get a Run Time Error 13 - Type Mismatch.

    It highlights the second line If Not Intersect(Target, Range("A:A")) Is Nothing And Target.Value <> "" And Range("B" & Target.Row).Value = "" Then in the debugger so is it something to do with the Target part?

    I can't work out how to correct it and wondered if anyone might know?

    Thanks
    DC

  2. #2
    Registered User
    Join Date
    02-22-2016
    Location
    Harare, Zimbabwe
    MS-Off Ver
    2007 & 2010
    Posts
    71

    Re: Type Mismatch Run Time Error with Code when deleting multiple cells contents

    Please read the rules and add Code Tags to your Code.

+ 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] Error with VBA Code - Mismatch Type when deleting cells
    By patrickmt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2015, 10:06 AM
  2. Run-time error '13' Type mismatch when deleting multiple cells
    By ANChester in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-03-2014, 12:35 PM
  3. Run-time error 13 - Type mismatch, when deleting cells
    By Johny1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2013, 02:01 PM
  4. [SOLVED] Run-time error 13 - type mismatch when deleting data from multiple cells at once
    By missnk in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2013, 08:38 PM
  5. VBA Code Run-time Error 13 - Type mismatch
    By jmancha in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-16-2013, 11:15 AM
  6. [SOLVED] Error 13 - Type Mismatch for my macro code for deleting rows based on condition.
    By Whitenoise1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-19-2012, 07:56 PM
  7. type mismatch error when deleting cells
    By thigham2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-05-2008, 05:04 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