+ Reply to Thread
Results 1 to 6 of 6

How to delete entire row if first cell of it is empty for specific range and worksheets

  1. #1
    Registered User
    Join Date
    05-06-2013
    Location
    bangalore, india
    MS-Off Ver
    Excel 2010
    Posts
    28

    How to delete entire row if first cell of it is empty for specific range and worksheets

    Hi I have a workbook as attached.
    The work sheets are named as first page,last page, static sheet, dynamic sheet and transfer sheet. the dynamic sheets add up every day for this workbook.
    My macro should Delete the entire row if its cell in column "A" is empty.
    Restrictions
    1. Macro should not work for first and last work sheets
    2. The range for static sheets(should be from "A5" row to the last used row) is different from dynamic sheets(should be from "A7" row to the last used row)
    3. In transfer sheet, the macro should run for rows below the black stripped row and also for the columns after the black stripped column if any cell from D8 is empty delete the entire column.
    I have written the macro as below but when I run the macro, it is only working for static pages and when i select any dynamic page and re-run the macro, it is performing for all the dynamic pages. Also I am not able to select the range for transfer sheet and perform the macro.

    Please help!!!

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by roshanvmech; 02-28-2014 at 11:36 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to delete entire row if first cell of it is empty for specific range and worksheet

    Just to clarify ... In the "Transfer sheet", if any cell in column A starting at row 25 is empty, you want to delete the entire row. Also if any cell in the range D8:AD8 is empty, you want to delete the entire column. Is this correct?
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to delete entire row if first cell of it is empty for specific range and worksheet

    Hello roshanvmech,

    The macros below work for the static and dynamic sheets and leaves the First and Last sheets alone. It wasn't clear to me from the post or the workbook what to do with the Transfer sheet. If you provide a good example of which cells are to checked, I can then write the code for the macro. Here are the macros' code. These have been added to the attached workbook.

    Macros are in the ThisWorkbook Module of the VBA Project
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    05-06-2013
    Location
    bangalore, india
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How to delete entire row if first cell of it is empty for specific range and worksheet

    Hi Mumps,
    Yes it is correct. But it is not always row 25 or till column AD8, the rows and columns increase or decrease day by day i.e., they are dynamic. The only mark is that those start after the cell which has the interior color black.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: How to delete entire row if first cell of it is empty for specific range and worksheet

    Hi roshanvmech. I think that Leith has you covered.

  6. #6
    Registered User
    Join Date
    05-06-2013
    Location
    bangalore, india
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: How to delete entire row if first cell of it is empty for specific range and worksheet

    Hi Leith,
    Your code is fantastic.
    For transfer sheet, I want the rows to be deleted from the range starting from the row below the black strip. i.e., in this sheet the black strip is at row 24 and the range from which this macro should run is from row 25 to the last used row. The catch here is the black strip varies from workbook to workbook.
    Similarly, for columns, the no. of columns differ from one workbook to another. I want the macro to delete the columns for which any cell between D8 to the last used column is empty, the entire column should be deleted.

+ 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. [SOLVED] Program a conditional script that will delete entire row if cell in column B is empty
    By Rabbitstew in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2012, 01:54 PM
  2. [SOLVED] Macro to delete entire row (within a specified range) if cell in column A is empty
    By instinctellekt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-07-2012, 10:01 AM
  3. Macro (Delete Entire row Cell in column R is empty)
    By andrewvt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2011, 07:06 AM
  4. Delete entire column if all cells in a certain range are empty
    By Andula in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-26-2011, 06:33 AM
  5. find <> empty cell in range, delete entire row
    By Shell_ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-26-2011, 12:36 PM

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