+ Reply to Thread
Results 1 to 17 of 17

Code to Copy only Rows With a Value in Column C greater than 0

  1. #1
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Code to Copy only Rows With a Value in Column C greater than 0

    I have a sheet named Entry and a sheet named Wood Total. When i click on a button with macro on the Entry Sheet it will send all data to the Wood Total sheet. I only want to copy rows with a value greater than 0 in column C. Can this code be modified to do this?

    Data.pdf

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    You do not need a code for this task, You can use Excel's filter function.
    This is untested code.

    Please Login or Register  to view this content.
    Last edited by AB33; 12-29-2013 at 02:40 PM.

  3. #3
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    I have data on the Entry sheet to the left and right of the cells that I want to copy, I dont want to filter this data. How will the filter effect these cells if any? Thanks

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    Well,
    If you do it manually, you can select any range. Try it using filter function.
    Have you tried my code?

  5. #5
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    My original post was not my actual workbook so the code you provided doesn't work. Sorry to waste your time.
    This is my actual workbook so If you could provide code I would greatly appreciate it.
    I really dont want to do it manually, I would like it to be automatic after clicking the button to send data only with a value greater than 0 in column I. If the value is 0 I dont want to copy. Thanks

    Book3.xlsx

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    STU22,
    No wonder why the code does not work. According to your code, you are copying from sheet entry in to wood, but according to the attached, it is the other way round.
    I will adjust the code, but where in sheet entry you want to copy the data in to?
    If column C of sheet wood is > 0, you want to copy from column A-J.
    Where exactly these values will be copied in to sheet entry?
    Last edited by AB33; 12-29-2013 at 02:43 PM.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    "I really dont want to do it manually".
    I did not mean you use copy and paste function. You can use filter function.
    Data-Filter (Auto filter is on), click column C arrow, choose the criteria, copy the required range and paste them in to sheet entry.
    No macro need, no complication.
    You can record your action if you wish to use a code.

  8. #8
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    I want to copy from sheet Entry G12:P20 to sheet Wood Total A1:J1. On the Entry sheet if the value in column I is 0 dont copy that row. On Wood Total sheet i need the copied data to fill the next blank row. Hope that all makes sense.

    I will also copy Sheet Entry cells G27:P37 to sheet Plam Total A1:J1. I was planning on just editing the code to do this, but I may not have enough knowledge to do it.

    I would like to do all this with one click of the button on the Entry Sheet Below the Picture.

    Thank You

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    Since all values in column I are zeros. I have changed some of the values in to 1 to test the code.
    Added a button on sheet entry.
    Attached Files Attached Files
    Last edited by AB33; 12-29-2013 at 03:22 PM.

  10. #10
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    Well, the code that you provided works great. Thank You
    But there is a problem with it working with the existing code I had that sends data to the Cabinet Total sheet. I thought I could leave that code the same as it was and just add the code that you provide to it. But after I use your click button it is much smoother than what I had, my screen would jump around and it would eventually send all the data to the right spot but it took it some time.
    My question to you is would you mind providing code to move the data to the Cabinet Total sheet? I have provided the code that i have that shows the cell to copy and where to copy them to. If you need any more info, I would be glad to help. Thank You so Much! Very Smooth
    Please Login or Register  to view this content.

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    I am not sure I understand what are you trying to do.
    The code I provide does not jump. It is fast and will not flick the screens. I do not understand why and how my code interfere with your code.

    If you want me to write you another code, you need to show me the desired result with explanation.

    I will doze- off in a minute.

  12. #12
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    No No your code is great, Very Smooth. My existing code was jumpy.

    I want to add to your code to Copy from the Entry sheet and Paste to Cabinet Total sheet.

    (Copy Entry Sheet Cell) (Paste to Cabinet Total sheet cell)
    Copy E18 Paste A1
    Copy E17 Paste B1
    Copy E21 Paste C1
    Copy B15 Paste D1
    Copy E13 Paste E1
    Copy AF12 Paste F1
    Copy AF13 Paste G1
    Copy AF16 Paste H1
    Copy AF14 Paste I1
    Copy AF15 Paste J1
    Copy AF19 Paste K1
    Copy AF18 Paste L1
    Copy AF20 Paste M1

    Hope this isnt to much, if so you can do when you get a chance.
    Thank You. Your very Kind.

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    Two buttons attached, one for each code.
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    snobl01,
    You have already created a thread and I have replied to that thread. Please check it.

  15. #15
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    Wow AB33 those two buttons are so smooth I cant tell that they are doing anything until I go to the appropriate sheet and there's all the data. Thanks

    Would it be to much to ask for 1 button to do both? I will have other users that will be using this someday and Im concerned that they may only click 1 button and not the other loosing data.

    Also one other thing and this will be perfect, I would like the value on the Entry sheet cell E18 and E21 to be " " after clicking the button.

    Thank You Very Much for Your Kindness!!

  16. #16
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    All done:-
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    10-26-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    133

    Re: Code to Copy only Rows With a Value in Column C greater than 0

    Works Perfect!!! I will have more of these to do in the future, Im sure I will need help. I would not mind hiring you to help me, do I need to do this through the site or can I PM you? If you are interested.

    Thanks Again for taking the time to help. I appreciate it.

+ 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. Copy rows to new sheet if value of cell entered greater than 1
    By larryluv1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-04-2013, 02:55 PM
  2. Copy any column if rox is greater then 0
    By gherzberg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-09-2012, 01:27 PM
  3. [SOLVED] how do I copy column if certain cell is greater than 0
    By gherzberg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-25-2012, 11:11 AM
  4. Delete Rows Column F if greater than or equal to zero.
    By EJensen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2009, 10:06 PM
  5. Extract and copy Rows where value is Greater than 0 (zero)
    By singh352@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-30-2005, 03:06 AM

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