+ Reply to Thread
Results 1 to 4 of 4

Sort values blank cells first

Hybrid View

sans Sort values blank cells first 01-13-2013, 01:08 PM
nilem Re: Sort values blank cells... 01-13-2013, 01:45 PM
sans Re: Sort values blank cells... 01-13-2013, 02:33 PM
sans Re: Sort values blank cells... 01-28-2013, 02:21 PM
  1. #1
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Sort values blank cells first

    Hello,

    I am trying to sort a range which contains number by having the blanks sorted out first. Is there a formula or vba solution to achieve this?

    Many thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort values blank cells first

    Hi sans
    maybe something like this
    Sub ert()
    Dim i&, r As Range
    On Error Resume Next
    With Range("B5").CurrentRegion
        For Each r In .Rows
            i = r.SpecialCells(4).Count
            If Err Then Err.Clear Else r.Cells(1).Resize(, i).Insert xlShiftToRight
        Next r
    End With
    End Sub

  3. #3
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Sort values blank cells first

    Thanks for the reply nilem. The macro works great. For some reason when I run it in the attachment above it works as expected but when I run it in my normal document I get no activity. Can't figure out why. Many thanks!

  4. #4
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    550

    Re: Sort values blank cells first

    Can the above be done with a formula? I need to use this function very often and a formula would be much faster to work with.

    Thanks!

+ 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