+ Reply to Thread
Results 1 to 5 of 5

past method of worksheet class failed

Hybrid View

  1. #1
    Registered User
    Join Date
    08-12-2013
    Location
    Piraeus, Greece
    MS-Off Ver
    Excel 2010
    Posts
    4

    past method of worksheet class failed

    Hi all,

    I am having the this problem. My paste method fails. I run my code in MS Excel 2010 and it fails
    while the same time if I run it on MS Excel 2003 it works perfectly. Can anyone help? Here is my code:


    Thanks in advance

    
    Sub APOTH_ASFALEIAS()
                               
    Sheets("FORMULAS(HIDDEN)").Select
    ActiveSheet.Unprotect
    
                    Sheets("FORMULAS(HIDDEN)").Select
                    Range("DA1:EZ600").Select
                    Selection.ClearContents
    
    
            Sheets("INPUT SHEET").Select
            Range("A1:AZ600").Select
            Selection.Copy
            Sheets("FORMULAS(HIDDEN)").Select
            Range("DA1:EZ1").Select
    '---Here it fails---
            ActiveSheet.Paste
    
    Sheets("FORMULAS(HIDDEN)").Select
    ActiveSheet.protect

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: past method of worksheet class failed

    Untested.

    Sub APOTH_ASFALEIAS()
    
    With Sheets("FORMULAS(HIDDEN)")
         .Unprotect
         .Range("DA1:EZ600").ClearContents
         Sheets("INPUT SHEET").Range("A1:AZ600").Copy
         Sheets("FORMULAS(HIDDEN)").Range("DA1").PasteSpecial xlValues
       .Protect
    End With
    End Sub

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: past method of worksheet class failed

    Hi, hatzisn,

    Sub APOTH_ASFALEIAS()
    
    With Sheets("FORMULAS(HIDDEN)")
      .Unprotect
    '  .Range("DA1:EZ600").ClearContents 'might not be necessary
      .Range("DA1:EZ600").Value = Sheets("INPUT SHEET").Range("A1:AZ600").Value
      .Protect
    End With
    End Sub
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    08-12-2013
    Location
    Piraeus, Greece
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: past method of worksheet class failed

    Hi AB33,

    Thank you for your answer. The fact is that I want also the formulas and not just the values of the cells.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: past method of worksheet class failed

    Use this line

    Sheets("FORMULAS(HIDDEN)").Range("DA1").PasteSpecial xlFormulas ''formulas only
    Sheets("FORMULAS(HIDDEN)").Range("DA1").PasteSpecial xlPasteAll 'paste all

+ 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. paste method of worksheet class failed
    By morevijay1982 in forum Excel General
    Replies: 7
    Last Post: 07-16-2012, 05:35 AM
  2. Paste Method of Worksheet Class Failed
    By rhudgins in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2011, 03:57 PM
  3. Select method of Worksheet class failed
    By g48dd in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-10-2009, 12:16 AM
  4. Copy method of worksheet class failed - help!
    By Chet Shannon in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-10-2006, 12:25 AM
  5. Copy method of Worksheet class failed
    By Francis Brown in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2005, 04:05 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