+ Reply to Thread
Results 1 to 9 of 9

Is it possible to have a script delete a row if it doesn't have something in column B or F

  1. #1
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Question Is it possible to have a script delete a row if it doesn't have something in column B or F

    I am looking for a script that will look at row B and F, and if there is nothing in one or the other it will delete the row... Is this possible?

    So in English, if There is something in B but not in F it will be left alone, and visa versa...

    Also, is there a way to make it so that if there is something in B, to copy something from one cell down up in N, then delete the row under it?

    Attached is a workbook I am working with so you have an idea of what I'm trying to do.

    Thanks.
    Attached Files Attached Files
    Last edited by Cyberpawz; 05-10-2012 at 08:22 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Is it possible to have a script delete a row if it doesn't have something in column B

    Hello..

    You want that:
    if B is empty and F is empty then delete that row
    if B has data and F is empty or the reverse the do not delete... Is this what you want?
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Is it possible to have a script delete a row if it doesn't have something in column B

    Yup, and if there is something in B, copy one down from N and bring up said date to the row above.

  4. #4
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Is it possible to have a script delete a row if it doesn't have something in column B

    I have done the first part ie. deletion part. The second part you said I m not clear with it. Pls can you explain it with an example?
    Mean while you can check the deletion part...

    POS2.xlsm

  5. #5
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Is it possible to have a script delete a row if it doesn't have something in column B

    Try the below code on a copy of the workbook you are using.


    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Is it possible to have a script delete a row if it doesn't have something in column B

    Quote Originally Posted by 111StepsAhead View Post
    Try the below code on a copy of the workbook you are using.


    Please Login or Register  to view this content.
    I get a subscript out of range.

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

  7. #7
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Is it possible to have a script delete a row if it doesn't have something in column B

    Change Sheet1 to the name of the worksheet you want it to run on.

  8. #8
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Is it possible to have a script delete a row if it doesn't have something in column B

    I updated the code so you only have to change the name in one place.

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Is it possible to have a script delete a row if it doesn't have something in column B

    Quote Originally Posted by jraj1106 View Post
    I have done the first part ie. deletion part. The second part you said I m not clear with it. Pls can you explain it with an example?
    Mean while you can check the deletion part...

    Attachment 155025
    Ok, This is what I need.

    You see the file, There are two rows I need.

    Lets take Row 6 and row 7 for this case, Row 6 needs to stay in tact. Row 7 needs to stay in tact too, but what I need is from row 7 to be placed into row 6 is Column N, which is the date.

    From there, I need all columns that don't have information in them deleted.

    Also I've noticed that there are two things out of alignment, E and F need to be put under D and E in row 7.

    I hope this makes sense.
    Last edited by Cyberpawz; 05-10-2012 at 09:22 AM.

+ 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