+ Reply to Thread
Results 1 to 11 of 11

Error type mismatch and how to copy entire record to next sheet

  1. #1
    Forum Contributor
    Join Date
    10-02-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    165

    Error type mismatch and how to copy entire record to next sheet

    Hi All,

    I am getting run time error 13 (type mismatch) while running below code. can you help me how to solve it

    Also, how can I move entire record to Archive sheet when date in column O is entered.

    HTML Code: 
    Attached Files Attached Files

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Error type mismatch and how to copy entire record to next sheet

    Sarat47,
    To fix the type mismatch error, you'll have to change the sheet names to match the ones in your workbook because there is no sht1 in your workbook. You'll also have to but the sheet name in quotes. Per your attached workbook
    this
    Please Login or Register  to view this content.
    Becomes
    Please Login or Register  to view this content.
    *Change the sheet name to the one you want.
    **Just looked at the code again, I see you in fact named sht1 Master Sheet. I'll have to look at it again.
    Last edited by gmr4evr1; 06-19-2018 at 12:07 PM. Reason: Added *
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    10-02-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    165

    Re: Error type mismatch and how to copy entire record to next sheet

    Thanks gmr for your help.
    I have assigned it in the code. But why is it not working.
    sht1 = "Master sheet"

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this ‼

    Quote Originally Posted by sarat47 View Post
    how can I move entire record to Archive sheet when date in column O is entered.
    PHP Code: 
    Sub Demo1()
        
    With Sheet2.Cells(1).CurrentRegion
            
    If Application.CountA(.Columns(15)) > 1 Then
                      Application
    .ScreenUpdating False
                     
    .Columns(15).AutoFilter 1">0"
                
    With .Offset(1).Resize(.Rows.Count 1)
                     .
    Copy Sheet1.Cells(Sheet1.UsedRange.Rows.Count 11)
                     .
    Delete xlShiftUp
                End With
                     
    .AutoFilter
                      Application
    .ScreenUpdating True
            End 
    If
        
    End With
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb Other way …


    Or via a worksheet event, paste this code to the Sheet2 (Master sheet) module :

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)
        If 
    Target.Count And Target.Column 15 And Target.Row And Target.Value 0 Then
                Application
    .EnableEvents False
            With Me
    .UsedRange.Rows(Target.Row)
                .
    Copy Sheet1.Cells(Sheet1.UsedRange.Rows.Count 11)
                .
    Delete xlShiftUp
            End With
                Application
    .EnableEvents True
        End 
    If
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  6. #6
    Forum Contributor
    Join Date
    10-02-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    165

    Re: Other way …

    Thanks Marc.
    Could you please check why I am getting run time error 13 (type mismatch) for first program.

  7. #7
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Error type mismatch and how to copy entire record to next sheet

    I think this line
    Please Login or Register  to view this content.
    should be
    Please Login or Register  to view this content.
    Although when I tried it, the error just moved to a different line

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Error type mismatch and how to copy entire record to next sheet

    Quote Originally Posted by sarat47 View Post
    Thanks gmr for your help.
    I have assigned it in the code. But why is it not working.
    sht1 = "Master sheet"
    Not necessary as worksheets codenames are yet assigned, like in my previous posts …

  9. #9
    Forum Contributor
    Join Date
    10-02-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    165

    Re: Error type mismatch and how to copy entire record to next sheet

    Based on your suggestion, I change to sheet1 but still the program is not working. can you please help me.
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    10-02-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    165

    Re: Error type mismatch and how to copy entire record to next sheet

    Hello Expert!!

    Can anybody help me whether the code can be modified in any alternative way.
    HTML Code: 

  11. #11
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Error type mismatch and how to copy entire record to next sheet

    Based on your suggestion, I change to sheet1 but still the program is not working. can you please help me.
    What part isn't working? I made the changes I suggested to your attached workbook and it worked.
    Did you try Marc's suggested.

+ 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. Replies: 0
    Last Post: 11-25-2014, 05:30 PM
  2. Runtime Error - Type Mismatch when copying and pasting cells in sheet with macros
    By lhickerson in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-18-2014, 01:25 PM
  3. 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
  4. Copying from one sheet to another gives a "type mismatch" error
    By Abdulwahab in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-30-2012, 04:23 PM
  5. Complile Error: Type Mismatch ??? After adding error trap
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2012, 03:50 PM
  6. [SOLVED] Help: Compile error: type mismatch: array or user defined type expected
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2005, 05:05 PM
  7. [SOLVED] type mismatch error-copies data from one sheet to another
    By Marcotte A in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2005, 10:25 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