+ Reply to Thread
Results 1 to 12 of 12

How to copy a row from one sheet to another if the number a column D1 greater than 0

  1. #1
    Registered User
    Join Date
    05-30-2012
    Location
    Cumbria England
    MS-Off Ver
    Excel 2010
    Posts
    8

    How to copy a row from one sheet to another if the number a column D1 greater than 0

    Hello,

    I am looking for a little help.

    I am building a stock system for our stores that needs to be in excel.
    I am getting quite far a head now but i need help on this on.

    The is a worksheet for every staff member (up to 40) within each sheet are 30 odd rows of kit when they sign out some kit column D will be populated with how much of this kit they are borrowing. If they still have kit outstanding there will be a number in column D with the amount they have. I would like to copy this row to sheet ("Kit Outstanding") until the kit is returned.

    File attached of what i have done so far.

    Thanks Gordon
    Attached Files Attached Files

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

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    So you want all rows from the sheets other than Stock, Staff ID and Scan Sheet to be copied to Kit Outstanding? Any other sheets to be excluded?
    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 Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    Try this code -
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button

  4. #4
    Registered User
    Join Date
    05-30-2012
    Location
    Cumbria England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    Hi Arlette,

    Thank you so much for this, I have just tired the code and it works great.

    I have just have a couple of tweaks if possible.

    1. Once the kit numbers have been changed to 0 the line in kit outstanding remains with 0 but it would be great if the row was deleted from kit outstanding when the number in the other sheet is changed to 0.

    2. Can the ranges be moved easily so that i can add an initial column in A and move the original columns to B,C,D and E respectively.

    Many Thanks

    Gordon

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

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    1. Once the kit numbers have been changed to 0 the line in kit outstanding remains with 0 but it would be great if the row was deleted from kit outstanding when the number in the other sheet is changed to 0.
    In this case, it will be good that you re-run the macro each time changes are done to the sheets.

    I have put a condition stating that if the cell in column D in the sheets is not blank, then move it to the KIT O/S sheet. Should i change it to if the cell is not = 0?

    Can the ranges be moved easily so that i can add an initial column in A and move the original columns to B,C,D and E respectively.
    Which ranges are you talking about? The one in Kit O/S sheet or in the other sheets?

  6. #6
    Registered User
    Join Date
    05-30-2012
    Location
    Cumbria England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    Yes if you could change it so that "if the cell is not = 0 that would be great.

    I will move the columns in all the other sheets along by one column so that they now are a = "initials" b = "Item ID" c = "Item Name" d = "Item Description" e = "Amount on Loan".

    So that when they copy to kit outstanding their are now 5 columns to copy instead of 4.

    Hope that makes sense
    Thanks
    Gordon

  7. #7
    Registered User
    Join Date
    05-30-2012
    Location
    Cumbria England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    New file with the changes so far.
    Attached Files Attached Files

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

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    Updated code
    Please Login or Register  to view this content.
    I have put the condition that it should check if the cell is not equal to 0 and not blank too. I found a blank cell in sheet JG so i put it in. Let me know if you need it removed.
    Last edited by arlu1201; 11-07-2012 at 10:56 AM.

  9. #9
    Registered User
    Join Date
    05-30-2012
    Location
    Cumbria England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    No thats great leave it as "equal to 0 and not blank.

    Thank you for this it works perfectly.
    Many Thanks
    Gordon

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

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    I removed the part checking for blank. Updated code above.

  11. #11
    Registered User
    Join Date
    05-30-2012
    Location
    Cumbria England
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    Thank You Very much appreciated

    Gordon

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

    Re: How to copy a row from one sheet to another if the number a column D1 greater than 0

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

+ 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