+ Reply to Thread
Results 1 to 12 of 12

Copy rows to second worksheet by checkbox

  1. #1
    Registered User
    Join Date
    11-18-2010
    Location
    Essex, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Copy rows to second worksheet by checkbox

    Hi,
    I'm working on a quote sheet where the products, sizes and prices are input on sheet1 and if a checkbox for that item is selected it populates a quote template on sheet2.

    I've linked checkboxs to the data but am stuck with the code to get the data accurately onto the second sheet.

    I'm currently using:
    Please Login or Register  to view this content.
    The problem I'm having with this code is I need the data on sheet 2 to start at row 11 (A11)and for every subsequent item checked to populate the next free cell below it. The code doesn't seem to do that, it's overwriting previous data and starting at row 10.

    Any help would be mucho appreciated!

    Sagsie.
    Last edited by sagsie; 11-18-2010 at 06:49 PM.

  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 rows to second worksheet by checkbox

    Hi sagsie

    Welcome to the Forum. You'll find this place totally amazing.

    You really need to use code tags around your code. The Forum is adamant about this. To do so:

    Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Select your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button). The result will appear like this in the post window:
    Please Login or Register  to view this content.
    An Administrator may do so for you since this is your first post. I can't (Not an Admin). Please do so at your earliest convenience.

    Can't test this but you might try
    Please Login or Register  to view this content.
    John
    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
    11-18-2010
    Location
    Essex, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Re: Copy rows to second worksheet by checkbox

    Hi John,

    Thanks for the advice re the code, I've changed it now so hope that helps.

    I tried your suggestion with the code, but in doing that, it's caused an error in selecting the row for copying?!?!

    Sagsie

  4. #4
    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 rows to second worksheet by checkbox

    Hi sagsie

    Thanks for adding Code Tags. Makes life for all of us much easier.

    Yeah, I don't really like to post untested code so I'm not surprised it doesn't work. Sorry about that.

    If you'd like me to work through the issue with you it would be helpful if you would post a mock up file of your actual data, including code so I can "see" what's happening.

    John
    Last edited by jaslake; 11-18-2010 at 07:30 PM.

  5. #5
    Registered User
    Join Date
    11-18-2010
    Location
    Essex, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Copy rows to second worksheet by checkbox

    Hi John,

    Ok, I've attached the basis of the file. I've removed the macro from the checkboxes for the time being as I was working on another way round.

    Where the checkbox creates a TRUE/FALSE statement in Column M of Sheet1 would it be easier to create a button on Sheet2 to "Create Quote" that searched Column M for TRUE values and then copied the relevant row to Sheet2?

    Anyway, hopefully by looking at this you'll see what I'm aiming for! This is my first stab at code and it's not exactly a cut and paste job!

    Cheers,

    Sagsie
    Attached Files Attached Files

  6. #6
    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 rows to second worksheet by checkbox

    Hi sagsie

    The problem with this (I think) is that I can't "see" what you are trying to do
    I've removed the macro from the checkboxes
    The reason I asked to see your current code is to "see" what you're trying to do so i can "see" what's happening. With your example file, nothing happens except "Clear Quote" but since there's nothing in Quote it doesn't tell me anything.

    Please attach a file that precipitated this question
    I'm working on a quote sheet where the products, sizes and prices are input on sheet1 and if a checkbox for that item is selected it populates a quote template on sheet2.

    I've linked checkboxs to the data but am stuck with the code to get the data accurately onto the second sheet
    I'm still trying to figure out WHAT you're trying to do. Once I understand that, you can go in any direction you choose.

    John

  7. #7
    Registered User
    Join Date
    11-18-2010
    Location
    Essex, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Question Re: Copy rows to second worksheet by checkbox

    Hi again John,

    Sorry, the checkboxes now have the macro attached.

    As you will see from clicking one, it populates Row10 of Sheet2 which wipes out the headers!

    I need it to start at Row11 and then seubsequent free rows after that.

    Cheers,

    Sagsie
    Attached Files Attached Files

  8. #8
    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 rows to second worksheet by checkbox

    Hi sagsie

    This appears to solve your immediate issue
    I need it to start at Row11 and then seubsequent free rows after that.
    Please Login or Register  to view this content.
    However it raises others. Now you can
    go in any direction you choose.
    John

  9. #9
    Registered User
    Join Date
    11-18-2010
    Location
    Essex, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Smile Re: Copy rows to second worksheet by checkbox

    Hey John,

    Thanks for the code, it works a treat!

    There is a snag with it though as you indicated there may be! When I click a checkbox, it transfers the row correctly, but then when I click a second checkbox, it transfers the first one again as well as the second.
    I need it to add the subsequent rows without duplicating the information.....if possible?!?!?

    Cheers,

    Sagsie

  10. #10
    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 rows to second worksheet by checkbox

    Hi sagsie


    Yes, I was aware of this issue. How to handle it depends on your needs. The checkbox can simply be unchecked and thus be available for future processing, the entire row can be locked so it's not available for future processing or the checkbox can be deleted and not be available for future processing.

    These three approaches come immediately to mind, there may be others. What would you like to happen?

    John

  11. #11
    Registered User
    Join Date
    11-18-2010
    Location
    Essex, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Smile Re: Copy rows to second worksheet by checkbox

    Hi John,

    I think I've cracked it by assigning your code to a button. I can then check the required boxes and by clicking the button transfer the lines

    I am a complete novice to coding so excuse if this is a dumb question, but.... is there some code I can add to the end of the existing code to select a cell on the second sheet?
    Lets say A1?

    It's purely to save clicking the second sheet after transferring the lines.

    Thank you so much for your assistance, I hope in time I can assist others. (That's some way off yet though!)

    Cheers,

    Sagsie.

  12. #12
    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 rows to second worksheet by checkbox

    Hi sagsie

    To select a cell the sheet must be active so, it would look like this
    Please Login or Register  to view this content.
    Glad you got it working.

    John

+ 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