+ Reply to Thread
Results 1 to 3 of 3

clear, copy and paste on different sheets

  1. #1
    Registered User
    Join Date
    12-17-2008
    Location
    thailand
    MS-Off Ver
    2007
    Posts
    28

    clear, copy and paste on different sheets

    hello,

    I recorded the following macro :
    Please Login or Register  to view this content.
    that works perfectly when I run the macro but it doesn't when I assign it to button1 showing a run-time error '1004' select method of range failed, every poor work around of mine failed too. The same happens for a slightly different code that I try to assign to button2. Attached is an example.

    thank you in advance and happy new year
    Attached Files Attached Files
    Last edited by robbi100; 12-31-2008 at 11:33 AM. Reason: solved

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,

    I've not looked at the attachment, but in general try to avoid using .Select or .Activate. As you've found when you use the macro recorder, your code gets littered with these instructions and they are rarely necessary. Just address the cell refs. directly. e.g. - but untested.

    Please Login or Register  to view this content.
    or even simpler if the sheet textual names are the same as the sheet index numbers

    Please Login or Register  to view this content.
    HTH

  3. #3
    Registered User
    Join Date
    12-17-2008
    Location
    thailand
    MS-Off Ver
    2007
    Posts
    28
    I've so much to learn. But hey, 8 mins for a positive feedback... this forum is great.
    Thank you Richard
    All the Best

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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