+ Reply to Thread
Results 1 to 6 of 6

Copy, Paste and Delete Row based on column criteria

  1. #1
    Registered User
    Join Date
    12-17-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Copy, Paste and Delete Row based on column criteria

    Hi all. Pretty new to VBA and Macros - so trying to learn as I go along. Object programming is rough!

    I know that macros similar to this have been asked about on these forums, so I apologize in advance for my redundancy.

    I have a task that I do every week I'd like to semi automate. I have a worksheet that has many columns, one of which is an IP address. I'd like to be able to find rows with certain IP addresses, copy them into a second sheet, and then delete the original row. Currently, my macro will find and copy all of the correct rows, but will not delete them at all. It's a bit of a mish mash between stuff I found online and trying to figure things out on my own.

    The column the IP is in is K, and there are S total columns.

    Here's what my macro looks like now

    Please Login or Register  to view this content.
    Obviously I need help getting the rows to delete from the 'Non Checked' sheet. If possible, I would also like to know if there's an easier way to check if a cell contains multiple IP addresses without doing an entire ElseIf.

    Thanks for any help!

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Copy, Paste and Delete Row based on column criteria

    Give this a try

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Registered User
    Join Date
    12-17-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copy, Paste and Delete Row based on column criteria

    Holy moly that works perfect!

    How would I go about extending this to check for another IP, say 'yyy.yyy.yyy.yyy'?

    Thanks!

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Copy, Paste and Delete Row based on column criteria

    Something like this

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-17-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Copy, Paste and Delete Row based on column criteria

    Ah this is great - looks like I was so far away from having something working!

    I really appreciate the help Mike!

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Copy, Paste and Delete Row based on column criteria

    Your welcome!

+ 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