+ Reply to Thread
Results 1 to 11 of 11

Cannot paste to another worksheet in private sub change event

  1. #1
    Registered User
    Join Date
    12-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Cannot paste to another worksheet in private sub change event

    Hi,

    I am trying to write a piece of code that is a private sub worksheet change event and I want to copy information from one sheet and paste it in another worksheet.

    It wont even let me select a cell on the other worksheet - I presume that this is because it is a private sub it wont let me influence other workbooks.

    Any ideas what I can do to remedy this - will making it a public sub make a difference or can I call the paste action from another macro? How would I go about doing this?

    Thanks

    Louise

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Cannot paste to another worksheet in private sub change event

    Can you provide us the code here?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    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

    Re: Cannot paste to another worksheet in private sub change event

    Hi,

    Given what you say there seems to be no reason why you can't use standard Sheet, Range, Copy, Paste instructions to do what you want. Neither do you need to use Select statements.

    Since you refer to copying from one worksheet to another I'm assuming you mean that they are both in the same workbook. If not just ensure you fully reference the workbook, sheet and range to be copied.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    12-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Cannot paste to another worksheet in private sub change event

    Please Login or Register  to view this content.
    Code supplied guys - cheers
    Last edited by arlu1201; 05-04-2012 at 07:13 AM. Reason: Code tags not quote tags.

  5. #5
    Registered User
    Join Date
    12-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Cannot paste to another worksheet in private sub change event

    Apologies, I got confused and meant to say workbook

  6. #6
    Registered User
    Join Date
    12-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Cannot paste to another worksheet in private sub change event

    Aaahhh I am having a mare with this one - I have tried using a copy destination syntax but it doesnt copy or paste anything:


    Please Login or Register  to view this content.

  7. #7
    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

    Re: Cannot paste to another worksheet in private sub change event

    Hi,

    Can you describe what you are trying to do? It seems to me that a data filter advanced might be a better option.

    And I don't see why you need to open the Pipeline workbook within the For next loop, particularly since you never explicitly close it.
    Seems to me that you only need to open it once and set a workbook variable for both the main workbook and the Pipeline workbook. Then you can explicitly reference the particular workbook/sheet/ranges you are trying to use.

    As well as describing what you want to do, upload the two workbooks as well.

  8. #8
    Registered User
    Join Date
    12-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Cannot paste to another worksheet in private sub change event

    Thanks Richard. Thanks so far Richard.

    Essentially I want to write a worksheet change event that is triggered when column P in the prospects spreadsheet is set to y. The code then checks column m for the date and then I want to copy column a of that row onto the corresponding month on the pipeline spreadsheet, e.g. date 13/01 column a then gets pasted onto January. To add a complication to it, the macro needs to paste it on the first available blank row.

    I will send over a copy of the spreadsheets when I am next at my computer, but I hope this helps to make things a bit clearer.

  9. #9
    Registered User
    Join Date
    12-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Cannot paste to another worksheet in private sub change event

    I attach the two files that I have been working on
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    12-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Cannot paste to another worksheet in private sub change event

    Bump, no solution yet.

    Thanks in advance for your help.

  11. #11
    Registered User
    Join Date
    12-14-2011
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Cannot paste to another worksheet in private sub change event

    I have solved the issue with tweaking the following code - Yippeee!!!

    Please Login or Register  to view this content.
    Thank you so much 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)

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