+ Reply to Thread
Results 1 to 5 of 5

Copy/paste from one worksheet to another based on checkbox

  1. #1
    Registered User
    Join Date
    10-03-2016
    Location
    Århus, Denmark
    MS-Off Ver
    2010
    Posts
    6

    Copy/paste from one worksheet to another based on checkbox

    Hi All.

    I've been struggling with an issue for a while now - hope there are some bright heads here, that can help me.

    I would like the following function:

    1. I have 11 checkboxes on worksheet 1. Each checkbox corresponds to a column in a table on worksheet 2 (so 11 columns in total).
    2. If I push a botton on worksheet 1, the program looks for the "state" (checked/unchecked) of the checkboxes;
    3. If the first checkbox is checked, it should look for the value in column L on worksheet 2 - but only from row 26. If it finds a cellvalue of 4 OR 5, it should copy all cells from column B to AC of that line (if more cells have a value 4 or 5 in line L it should copy them all.
    4. The copyed data PLUS formatting should then be pasted on worksheet 1 from cell B23 in the last available row - BUT ONLY if the line/cells isn't already copied to worksheet (I would like a list of unique entries)
    5. If the second checkbox is checked, it goes through the same routine as above, but this time it looks for 4 or 5 i column M on worksheet 2
    6. And so on with the remaining 9 checkboxes on worksheet 1 and columns in workseet 2 (checkbox 3 looks in column N, checkbox 4 in column O, checkbox 5 in column P....checkbox 11 looks in column V)

    Hope it all makes sense!

    Here is what I have so far - if there is a more "smooth"/optimized way to do this, feel free to comment on that:

    Please Login or Register  to view this content.
    Workbook is attached. Hope some of you can help - if not with all just parts of the code then
    Attached Files Attached Files
    Last edited by Jakob83; 05-31-2018 at 04:12 PM. Reason: misspelling

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Copy/paste from one worksheet to another based on checkbox

    Hi Jakob83

    Give this a go...
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    10-03-2016
    Location
    Århus, Denmark
    MS-Off Ver
    2010
    Posts
    6

    Re: Copy/paste from one worksheet to another based on checkbox

    Hi Sintek,

    very cool!

    This seems to do the trick! I like, that you've taken a totally different approach - I'll have to dig more into that. It's way more elegant, and much faster when the number of data increases!

    Well done!

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Copy/paste from one worksheet to another based on checkbox

    Glad I could help...tx for rep +

  5. #5
    Registered User
    Join Date
    10-03-2016
    Location
    Århus, Denmark
    MS-Off Ver
    2010
    Posts
    6

    Re: Copy/paste from one worksheet to another based on checkbox

    Just in case anyone else would like to use the code, I've added the following to the above:

    Please Login or Register  to view this content.
    This removes any dublicates that might have gotten copied to the the list (if e.g. a row has 5 i both column L and M). This way I'll end up with a list with unique values.

    Again - thanks for bringing me further, Sintek

+ 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. How to Select and Copy/Paste Columns Based on Checkbox
    By krayon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2016, 05:48 PM
  2. [SOLVED] Copy/paste data using checkbox-clear when unchckd & multiple selections paste in next cell
    By Staceymcw in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-02-2015, 12:09 AM
  3. Copy Paste in another worksheet based on cell value vba
    By Penny110 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-05-2015, 09:47 AM
  4. Copy Paste row from one worksheet to another based on DATE
    By niketmohan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2011, 08:29 AM
  5. Copy row based on date and then paste into a new worksheet based on section number
    By calmlaunch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-25-2011, 11:40 PM
  6. Replies: 3
    Last Post: 11-12-2010, 04:31 AM
  7. trying to copy/paste row based on checkbox caption and cell content
    By Zygoid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-11-2007, 06:09 AM

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