+ Reply to Thread
Results 1 to 16 of 16

Copy only rows with data to second sheet, delete from first sheet

  1. #1
    Registered User
    Join Date
    02-05-2014
    Location
    Denver
    MS-Off Ver
    Excel 2013
    Posts
    5

    Copy only rows with data to second sheet, delete from first sheet

    I have a client list that I'd like for our Account Managers to be able to use to keep a running log of client contact.

    I've looked through the Forum and haven't been able to find exactly what I'm looking for. And as I'm Visual Basic deficient I've been unable to piece meal it together.

    What I am trying to do is capture information on sheet "Client Information" in Columns A, B, O, P, Q, R, and S but only if there is information in P, Q, R, and S. I need this info populated on a second sheet named "Client Log." Once copied I need Columns P, Q, R, and S cleared from sheet "Client Information" so it's clear for the next input.

    I'm not sure it matters but our current client list is 250 and growing. If possible I'm looking for code that can grow with our client base.

    Thank you in advance,

    Antonio "The Visual Basic Deficient" (I need a cape!)
    Attached Files Attached Files
    Last edited by Tonomono; 02-19-2014 at 06:37 PM. Reason: Left out info on the delete or clearing of columns P, Q, R, and S

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

    Re: Copy only rows with data to second sheet, delete from first sheet

    Your request is not clear as using OR and AND will give you different results. I assumed OR, that if any columns P-S are not empty.
    Attached Files Attached Files
    Last edited by AB33; 02-19-2014 at 07:10 PM.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy only rows with data to second sheet, delete from first sheet

    Hi Monotono,

    Welcome to the forum

    Here's a VBA solution:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    Copy the code to the clipboard

    Open your Workbook

    Save your Workbook or Another Workbook designated for Macros as Macro_Enabled

    Press ALT + F11 to open the Visual Basic Editor.

    Select “Module” from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    02-05-2014
    Location
    Denver
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Copy only rows with data to second sheet, delete from first sheet

    Thank you for the quick response!

    Now that the info is copying over is there a way to clear the entries from the "Client Information" sheet so that future entries can be made? And that future copying starts at the first empty row on the "Client Log?

    Thanks,
    Antonio

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

    Re: Copy only rows with data to second sheet, delete from first sheet

    Antonio,
    I have adjusted the code to clear columns P-S. Do you want to clear all data in sheet client?

  6. #6
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy only rows with data to second sheet, delete from first sheet

    this should do it

    Please Login or Register  to view this content.

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

    Re: Copy only rows with data to second sheet, delete from first sheet

    The attached code clears all data, except the header, so you now have 2 solutions.
    Attached Files Attached Files

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

    Re: Copy only rows with data to second sheet, delete from first sheet

    Sorry! I missed copy in to the next empty row.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-05-2014
    Location
    Denver
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Copy only rows with data to second sheet, delete from first sheet

    rcm,

    This is working how I need it to. Except that Column O is being deleted from the "client Information" sheet. If possible I need that info to stay.

    Thanks,
    Antonio

    I really do appreciate all the help, guys!

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

    Re: Copy only rows with data to second sheet, delete from first sheet

    What is the condition? Is it OR or AND.
    Do you want to copy if all columns P-S are empty(AND) or any of these columns is empty(OR)?

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy only rows with data to second sheet, delete from first sheet

    Hi Tonomono,

    Thanks for the rep, but I'm deleting the whole record from the first sheet. If you only want the four fields deleted then change:

    Please Login or Register  to view this content.
    To:

    Please Login or Register  to view this content.

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

    Re: Copy only rows with data to second sheet, delete from first sheet

    Button on sheet client.
    Attached Files Attached Files
    Last edited by AB33; 02-19-2014 at 07:48 PM.

  13. #13
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Copy only rows with data to second sheet, delete from first sheet

    I changed the for next loop to start at the 16 (15 is the O column)
    Please Login or Register  to view this content.

  14. #14
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy only rows with data to second sheet, delete from first sheet

    And (continued):

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Here:

    Please Login or Register  to view this content.
    Last edited by xladept; 02-19-2014 at 08:48 PM.

  15. #15
    Registered User
    Join Date
    02-05-2014
    Location
    Denver
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Copy only rows with data to second sheet, delete from first sheet

    Appreciate all the help, guys.

    Consider it solved!

    Antonio

  16. #16
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy only rows with data to second sheet, delete from first sheet

    You're welcome and thanks for the reps!

+ 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. Replies: 1
    Last Post: 11-14-2013, 09:24 PM
  2. [SOLVED] Copy row from sheet 1 to next row in sheet 2. delete from sheet 1 and move rows up
    By papabob1954 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-16-2012, 09:38 PM
  3. Replies: 4
    Last Post: 07-24-2012, 07:09 AM
  4. Delete Rows that contains zero and Copy active sheet to New Sheet
    By antoni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2009, 02:02 AM
  5. Copy & Delete Rows to Another Sheet
    By cindy1971 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2008, 12:50 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