+ Reply to Thread
Results 1 to 3 of 3

Copy row VBA getting mismatch error

  1. #1
    Registered User
    Join Date
    01-23-2009
    Location
    Adelaide
    MS-Off Ver
    Excel 2016
    Posts
    30

    Copy row VBA getting mismatch error

    Hi All

    I am getting a mismatch error when I run this code. Basically I just want to be able to insert a new row and have existing formulas, formatting copied, which works pretty well, but I now get a mismatch error with some other code. How do I resolve this?

    Please Login or Register  to view this content.
    This is the error; runtime error 13

    Please Login or Register  to view this content.
    Thanks
    Isacael

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Copy row VBA getting mismatch error

    With this:
    PHP Code: 
     Then Target.Value 
    the Worksheet_Change event is forced to trigger again.
    To prevent this, try to turn off the Events, then turn on again after running

    PHP Code: 
    Private Sub ...
    Application.EnableEvents False
    ...main code
    Application
    .EnableEvents True
    End Sub 
    Quang PT

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,615

    Re: Copy row VBA getting mismatch error

    When you copy in the first macro, the target becomes the entire row (16k columns)
    In your CHANGE macro, you need to reset the target to the activecell:
    Please Login or Register  to view this content.
    Ben Van Johnson

+ 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] UBound coll error after converting macro. Runtime error 13. Type mismatch.
    By Elijah in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-30-2020, 05:08 AM
  2. Mismatch error when copy/pasting from other workbook
    By CMarsh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-10-2019, 07:47 AM
  3. [SOLVED] VBA copy value from array to another array - Type mismatch error
    By gargantuLars in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2019, 01:13 PM
  4. [SOLVED] Error type mismatch and how to copy entire record to next sheet
    By sarat47 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-22-2018, 01:00 PM
  5. Put image in userform from Copy/Paste - Mismatch error
    By Ched_B in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-29-2017, 10:03 AM
  6. Check TargetColumn, TargetValue for Text Value, copy, repeat (mismatch error)
    By FrothyD in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-20-2014, 01:00 PM
  7. Run-time error '13' Type mismatch; drag and copy
    By travis1020 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2012, 02:52 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