+ Reply to Thread
Results 1 to 5 of 5

Copy non contiguous cells to new sheet

  1. #1
    Registered User
    Join Date
    10-03-2012
    Location
    Anderlecht
    MS-Off Ver
    Excel 2003
    Posts
    14

    Copy non contiguous cells to new sheet

    Hello,

    I am trying to set up a page which holds the info of all workers that worked on a specific given
    date.
    All workers are in a sheet which holds start and end date of contract and which team they were assigned to.
    So far I have come up with a working solution ... the only thing is that it errors out when I try to clear (using clearcontents)
    the previous run of the macro. (for another date)
    It's specifically the clearcontents which leads to the error ... when I comment it out the code works but then the data might not
    be correct if on the given date less workers worked in a team (that is old data is not overwritten!)

    Can anyone shed a light on why it errors?? I tried debugging but I can't seem to find it. I thought it might have someting to do
    with losing focus on active cell so I tried activating a cell after "clearcontents" but to no avail.

    In a nutshell:
    There are 2 Sheets (Traject and Ploegen)
    The first sheet holds all the workers that worked for us (of course I changed all privacy data)
    Second Sheet is the template that needs filling in on a specific date.

    I created a macro attached to the button "Ploegen" which calls Sub Copytest with a date as argument.

    Any help or pointers in the right direction is greatly appreciated
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy non contiguous cells to new sheet

    Hi timpie

    There's nothing in the Clipboard...this line of Code clears the Clipboard
    Please Login or Register  to view this content.
    You'll need to move the Copy Code to execute after the Clear Code or execute the Clear Code before the Copy Code.
    Last edited by jaslake; 11-01-2014 at 02:37 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    10-03-2012
    Location
    Anderlecht
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Copy non contiguous cells to new sheet

    Thank you for your reply ... but this doesn't make sense to me. Maybe I don't understand what you mean?
    The clearcontents is actually to clear old data before pasting the copied data in this place.

  4. #4
    Registered User
    Join Date
    10-03-2012
    Location
    Anderlecht
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Copy non contiguous cells to new sheet

    I see now! Apparentely the clearcontents (supposed to clear data on the selected range???) clears ALSO the clipboard
    so there is actually NO data anymore.

    Solved!!

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Copy non contiguous cells to new sheet

    Hi timpie

    You've got it.

    If this resolves your issue please mark your Thread as SOLVED.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. [SOLVED] copy and paste from contiguous cells to non-contiguous cells using the = function
    By shameus in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-05-2013, 06:48 PM
  2. Replies: 5
    Last Post: 07-31-2013, 01:50 AM
  3. Copy non-contiguous cells from one sheet to another
    By Grizz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-08-2010, 11:44 PM
  4. Copy and Paste an array (contiguous & non contiguous ranges)
    By Xrull in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-09-2010, 09:17 AM
  5. Copy Non Contiguous cells
    By jerryliang2k in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-28-2008, 02:01 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