+ Reply to Thread
Results 1 to 5 of 5

Mismatch error when copy/pasting from other workbook

  1. #1
    Registered User
    Join Date
    06-09-2019
    Location
    Glasgow, Scotland
    MS-Off Ver
    2019
    Posts
    3

    Mismatch error when copy/pasting from other workbook

    I'm trying to copy and paste from a user selected worksheet in another workbook to a user selected worksheet in the current workbook but I'm getting a mismatch error from the variable I'm using for the worksheet name.
    Attached Files Attached Files

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

    Re: Mismatch error when copy/pasting from other workbook


    At least crystal clear explain your issue, on which codeline from which code, which variable, …

  3. #3
    Registered User
    Join Date
    06-09-2019
    Location
    Glasgow, Scotland
    MS-Off Ver
    2019
    Posts
    3

    Re: Mismatch error when copy/pasting from other workbook

    I get the error on line 15 with the variable rngWeightedChosen

    Sheets(rngWeightedChosen).Select

    Attachment 627671

    The variable seems to have the correct value but is obviously of the wrong type, despite this type working in another Sub.

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

    Arrow


    If the variable content & type are correct - easy to check via the Locals window - so this sheet does not exist in the current workbook …

  5. #5
    Registered User
    Join Date
    06-09-2019
    Location
    Glasgow, Scotland
    MS-Off Ver
    2019
    Posts
    3

    Re: Mismatch error when copy/pasting from other workbook

    I’ve found a work around. By changing the worksheet names in the secondary sheet it allows me to use the worksheet reference number rather than the name. I’m not sure why this works but it does. Thanks for your help.

+ 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. Type mismatch error after pasting values
    By jaydog0813 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2018, 11:21 AM
  2. [SOLVED] How to copy from source workbook and pasting at first empty row in destination workbook
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-29-2017, 10:20 AM
  3. Copy/pasting from one workbook to another - Out of range error
    By isabelle.r in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-04-2017, 03:40 AM
  4. 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
  5. 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
  6. Replies: 0
    Last Post: 08-11-2011, 01:23 AM
  7. [SOLVED] Type Mismatch Error when getting data from another workbook
    By Tony Zappal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2005, 07:06 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