+ Reply to Thread
Results 1 to 6 of 6

How to remove blank cels

  1. #1
    Registered User
    Join Date
    02-10-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    58

    How to remove blank cels

    I'm sure this has been brought up before, but I need to remove blank cells from columns and
    consolidate the remaining ones at the top. The attachment has is an example of the unfixed
    columns.

    Thanks as always.
    Attached Files Attached Files

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

    Re: How to remove blank cels

    Hi

    Try this code:

    Sub delblanks()
    Dim r As Long, cnt As Integer

    r = Sheets("sheet1").Range("A" & Rows.Count).End(xlUp).Row
    cnt = 1

    For i = 2 To r
    If Sheets("sheet1").Range("A" & i).Value = "" And Sheets("sheet1").Range("B" & i).Value = "" Then
    Sheets("sheet1").Rows(i & ":" & i).Delete
    i = i - 1
    cnt = cnt + 1
    End If
    If cnt > r Then
    Exit For
    End If
    Next
    End Sub
    Regards
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Registered User
    Join Date
    02-10-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    58

    Re: How to remove blank cels

    Thanks for the code. However, I'm not sophisticated enough to know how to use it.
    Would you please be so kind as to enlighten me.

    Hook

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to remove blank cels

    Hook,

    Looking at your example file, why don't you just use a sort on LLNAME? Here's how:
    1. Select columns A and B
    2. Go to the Data tab on the ribbon
    3. Click the big Sort button
    4. Check "My data has headers"
    5. In the Sort By, select LLName
    6. Click OK

    Attached are screenshots showing the instruction steps and sort results.
    Attached Images Attached Images
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Registered User
    Join Date
    02-10-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    58

    Re: How to remove blank cels

    Hey tigeravatar,

    That's way too simple. I wanted something high powered and complicated.

    And am I ever embarrased.

    Thanks much.

    Hook

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to remove blank cels

    You're very 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