Results 1 to 7 of 7

Excel VBA 2010 - Copy to WB, RTE 1004 - That command cannot be used on multiple selections

Threaded View

  1. #1
    Registered User
    Join Date
    09-07-2014
    Location
    Denmark
    MS-Off Ver
    2010
    Posts
    5

    Excel VBA 2010 - Copy to WB, RTE 1004 - That command cannot be used on multiple selections

    Dear all,

    I have an issue in my Code.
    Sometimes it runs without issues, and sometimes not. I have not found the system.

    I want to copy a named area in a sheet in current wb (XLSM) to a new workbook. As default, new wb's are xlsx.
    I have read somewhere, that this error can occur, if the new wb is xls. But that is not the case.

    In the worksheet there are som hidden columns, but these are not part if the named area.

    When an issue occurs, it is the same place. Please see the red line below.


    Sub MailAnalysisSub()
    
    Application.ScreenUpdating = False
    
    Dim TempWorkbook As Workbook
    Dim Tempsht As Worksheet
    
    '----------
    'Create new Workbook
    Set TempWorkbook = Workbooks.Add
    FolderPath = Application.ThisWorkbook.Path & "\14.ShipReport_Controller" & "\14.ShipReport_SentReportingPackages\"
    Application.DisplayAlerts = False
    
    TempWorkbook.Activate
    Set Tempsht = Worksheets.Add
    Tempsht1 = ActiveSheet.Name
    ActiveSheet.Name = "Tempsht1"
    
    '------------
    ThisWorkbook.Worksheets("Input_Risk").Activate
    ThisWorkbook.Worksheets("Input_Risk").Unprotect
    Range("PrintArea_NotPaymentRisk").Select
    
    Selection.Copy
    
    TempWorkbook.Activate
    Sheets("Tempsht1").Activate
    Cells(1, 1).Activate
    
    Selection.PasteSpecial Paste:=xlPasteValues
    Selection.PasteSpecial Paste:=xlPasteFormats
    Selection.Name = "PrintArea_NotPaymentRisk"
    
    Application.CutCopyMode = False
    
    
    
    ...more code.......
    I hope you can shed som light over this issue - what am I doing wrong, and most exciting, why is this not a consequence error. Sometimes it works, sometimes not.

    wbr
    Benjamin
    Last edited by Sleever; 09-07-2014 at 01:50 PM. Reason: Adding [CODE] as requested

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 10-21-2013, 02:55 PM
  2. Copy and paste for multiple selections
    By amartino44 in forum Excel General
    Replies: 3
    Last Post: 07-12-2013, 02:34 PM
  3. Replies: 3
    Last Post: 05-16-2013, 06:08 AM
  4. Copy multiple selections in excel 2003
    By John Musbach in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2009, 09:08 PM
  5. [SOLVED] I cannot do the oopy paste command in multiple selections in the .
    By Penny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2005, 12:05 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