+ Reply to Thread
Results 1 to 16 of 16

Need to delete a title cell based on value of the cell underneath

  1. #1
    Registered User
    Join Date
    03-18-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    8

    Need to delete a title cell based on value of the cell underneath

    Hi,

    I have a generic Excel invoice with columns and rows that are not always used for every single billing and I'm trying to tidy it up. For example, the invoice has a cell named "Description" and cells underneath it; however, sometimes, the description is not needed on the invoice and the cells under it are empty. I have managed to leftshift the empty cells, but I would like to delete the title cell as well if there is nothing under it. That is, the cell with "Description" should be deleted with all cells under it if they are empty. This goes for any other cells which have titles, but nothing underneath them.

    I hope this is clear. I don't have much experience in Excel VBA (done some Word).

    Thanks for all the input.

    Leffe

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need to delete a title cell based on value of the cell underneath

    A small xlsx sample file will be help full to see where are the titles etc...
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    03-18-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    8

    Re: Need to delete a title cell based on value of the cell underneath

    Hi,

    Thanks. This is the sample.

    So, for example, if cells under "elevation", "floor", and "grid" are empty, the title cells should be deleted as well as the empty cells..

    Thanks again,

    Leffe
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need to delete a title cell based on value of the cell underneath

    "the title cells should be deleted as well as the empty cell"
    is that means you want to shift left the remaining information, somehow to delete columns A to C
    or just clean up cells A13 to C13
    Do you want to fire the macro when leaving the tab?

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need to delete a title cell based on value of the cell underneath

    If you want to shift left the remaining information
    Try next code and we can later when to launch the macro.
    Please Login or Register  to view this content.
    Last edited by PCI; 03-19-2015 at 03:50 PM.

  6. #6
    Registered User
    Join Date
    03-18-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    8

    Re: Need to delete a title cell based on value of the cell underneath

    Thank you!!! Works perfectly. One thing though, the totals in red are being deleted as well.

    Thanks again!

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need to delete a title cell based on value of the cell underneath

    Not sure to get it right, you want the totals in red to be deleted ...?
    Or you want them no to be shift ?
    Last edited by PCI; 03-19-2015 at 04:21 PM. Reason: Additional info asked

  8. #8
    Registered User
    Join Date
    03-18-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    8

    Re: Need to delete a title cell based on value of the cell underneath

    No, I'd like them to stay there. The code deletes them....

  9. #9
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need to delete a title cell based on value of the cell underneath

    Try again with next code
    If it's not good, explain where you want the totals to be placed
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-18-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    8

    Re: Need to delete a title cell based on value of the cell underneath

    Thanks. This works as intended, although I'm starting to doubt that what I'm trying to achieve is a actually a good idea.

    After the deletion of the empty cells I would like to have it as attached, which probably is totally different to what I tried to do initially...

    Thank you again,
    Leffe
    Attached Files Attached Files
    Last edited by leffe; 03-20-2015 at 10:40 AM.

  11. #11
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need to delete a title cell based on value of the cell underneath

    It means, after deletion, you want the description on the left and all remaining others columns on the right?
    Are columns "Elevation", " Floor", "Grid" the only one which can be empty?

  12. #12
    Registered User
    Join Date
    03-18-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    8

    Re: Need to delete a title cell based on value of the cell underneath

    Any of the columns can be empty. If "Elevation" is empty, then the whole column should be cleared and merged with "Floor". If "Floor" is empty then it is cleared and merged with the next cell, which has data. If "Unit" is empty, then it should be cleared and merged with "Rate", and so on....

    I hope this is clear.

    Thank you for your help!

  13. #13
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need to delete a title cell based on value of the cell underneath

    There is an hiden column "H", what to do with ?

  14. #14
    Registered User
    Join Date
    03-18-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    8

    Re: Need to delete a title cell based on value of the cell underneath

    Hi,

    Sorry, but I can see that all columns are unhidden.

    Thanks.

  15. #15
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need to delete a title cell based on value of the cell underneath

    OK it was in your previous file
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    03-18-2015
    Location
    London
    MS-Off Ver
    Office 2010
    Posts
    8

    Re: Need to delete a title cell based on value of the cell underneath

    Oh, ok. That total should not be there.

+ 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] Macro to auto select adjacent cell then cell underneath
    By strud in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-21-2013, 05:48 AM
  2. [SOLVED] Autofill cell underneath but only if adjacent cell in next column contains data
    By picton2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2013, 07:36 AM
  3. Delete row based on cell FORMAT (color, font, etc) (not based on cell value)
    By trobey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2012, 10:39 AM
  4. [SOLVED] [SOLVED] Make chart title based on a cell?
    By pokdbz in forum Excel General
    Replies: 3
    Last Post: 07-11-2006, 02:35 PM
  5. [SOLVED] Title in one cell covering space of 3 cells underneath
    By PSNYDE in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-12-2006, 01:45 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