+ Reply to Thread
Results 1 to 7 of 7

Run-Time error '13' - macro

  1. #1
    Registered User
    Join Date
    12-12-2005
    Posts
    23

    Run-Time error '13' - macro

    Hello -

    I am trying to run a macro on a drop down list which i created using Data Validation. I copy the code that I need from one of the post here. It is working in the their worksheet (which I found on this forum) then I copy into my spreadsheet I gets an error "Run-Time error '13' - Type Missmatch. at this line" If Target.Value = "Value1" Then"

    here code:
    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim LR As Long
    LR = Range("A" & Rows.Count).End(xlUp).Row

    If Flag = True Then Exit Sub

    If Target.Column = 1 Then

    If Target.Value = "Value1" Then
    If Not Intersect(Target, Range("A1:A" & LR)) Is Nothing Then

    LR = Sheets("Tab1").Range("A" & Rows.Count).End(xlUp).Row + 1
    Target.EntireRow.Copy
    Sheets("Tab1").Range("A" & LR).PasteSpecial
    Flag = True
    Target.EntireRow.Delete
    End If
    End If
    End If
    Application.CutCopyMode = False
    Flag = False
    End Sub


    Thanks,
    vasu

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Run-Time error '13' - macro

    Is Target.Value (IE: the cell you are in when the macro launches) a Text or a number?
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Run-Time error '13' - macro

    Almost all macro's are project specific and will not work when copied and pasted without alteration. With that being said, this code is all wrong for a drop down box. What is it that you are actually trying to do?

  4. #4
    Registered User
    Join Date
    12-12-2005
    Posts
    23

    Re: Run-Time error '13' - macro

    Text.

    Values are: Network, Process, Searching, Installation

  5. #5
    Registered User
    Join Date
    12-12-2005
    Posts
    23

    Re: Run-Time error '13' - macro

    If a user select a value from a drop down, that row should move to a tab.

    for example: on a row #15, I selected a "Network" as my value on column A --> then the row#15 should move to Network tab on the workbook and Delete the row#15 from sheet1 tab.

    Quote Originally Posted by stnkynts View Post
    Almost all macro's are project specific and will not work when copied and pasted without alteration. With that being said, this code is all wrong for a drop down box. What is it that you are actually trying to do?

  6. #6
    Registered User
    Join Date
    12-12-2005
    Posts
    23

    Re: Run-Time error '13' - macro

    The code is working fine its just throwing error message user select the value in drop down list.

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Run-Time error '13' - macro

    Quote Originally Posted by myguess21 View Post
    The code is working fine its just throwing error message user select the value in drop down list.
    So the code is working just fine, but it's throwing an error and not working.

    Try this:

    Please Login or Register  to view this content.

+ 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. Autofilter Macro Failing - Run-time error 91 - full macro code is attached
    By evamarie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2013, 02:36 PM
  2. [SOLVED] Macro causes Run time error 1004 Application defined or object-defined error
    By Firefighter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2012, 04:09 AM
  3. [SOLVED] Macro error - Run time error 1004 (App defined/Object Defined error)
    By jlax34 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-06-2012, 03:02 PM
  4. Excel Macro Error - Run time error 1004 - Paste method of worksheet class failed
    By kvflynn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2012, 10:51 AM
  5. Run-time error '1004': Macro error, only when shared
    By Pergo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2011, 12:57 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