+ Reply to Thread
Results 1 to 6 of 6

Delete rows if cell is empty

  1. #1
    Registered User
    Join Date
    12-16-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    Delete rows if cell is empty

    Hello everyone,

    I'm trying to adjust an excel file which contains sequential numbering down column A starting in row 14, ending row 37. I need this column to keep rows 14 and below sequentially numbered starting from number 1.

    Each row has the number cell (column A) as mentioned above, a description cell (column B) - the contents of which is not important in this problem and two more cells (columns C and D) which contain the letter a in each of them. (The lowercase letter a is used as a tick via the webdings font.)

    So this worksheet is like a checklist and I would like the worksheet to remove rows where there is no tick (lowercase a) and therefore empty in both cells C and D.

    I would like the rows to be removed as I remove the ticks, not altogether as one process on the whole document.

    As the row is deleted, the rows below move up and for example - if row 1 was deleted, row 2 moves up and becomes labelled as row 1 and so on and so forth.

    Your advice will be most welcome!

    Thanks!

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Delete rows if cell is empty

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


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    12-16-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Delete rows if cell is empty

    Thanks for this Solus.

    After all your hard work I feel a little bad about mentioning that the code deletes the row successfully but it deletes the row if EITHER cells C or D do not have data in them.

    I need the worksheet to delete the row if BOTH cells C and D are empty in that particular row.

    The sequential numbering is also a bit of an issue as it doesn't happen.

    I hope this isn't a complicated issue for you pros as it is for me.....I tried to learn the programming, but I really cant get my head round it.....accountant lumbered with a programming task from the boss!

  4. #4
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: Delete rows if cell is empty

    If Target.column = 3 Then

    If Target.Value = "" and target.offset(0,1).value = "" Then
    Application.EnableEvents = False
    Target.EntireRow.Delete
    Application.EnableEvents = True
    End If

    If Target.column = 4 Then

    If Target.Value = "" and target.offset(0,-1).value = "" Then
    Application.EnableEvents = False
    Target.EntireRow.Delete
    Application.EnableEvents = True
    End If

    End if

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Delete rows if cell is empty

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-16-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Delete rows if cell is empty

    Solus,

    Thank you ever so much.

    SW

+ 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] Search for empty cell and delete that row plus the next 19 rows even if they contain data
    By aprcamb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-13-2013, 11:43 AM
  2. Replies: 7
    Last Post: 09-06-2012, 04:12 PM
  3. Delete rows when certain cell is empty
    By seanyeap in forum Excel General
    Replies: 19
    Last Post: 03-30-2010, 10:17 PM
  4. Delete empty rows with cell type 2
    By FrankNL in forum Excel General
    Replies: 1
    Last Post: 05-03-2006, 06:15 AM
  5. [SOLVED] Delete rows foward if cell is empty
    By Metrazal in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-24-2006, 09:30 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