+ Reply to Thread
Results 1 to 5 of 5

Alphabetically Order list

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Alphabetically Order list

    Please refer to attached excel sheet.

    I need a VB Macro to perform following task..

    Sheet1 column 1 shows Company names....some companies listed multiple times
    From here i wanted to create alphabetically Company names listed once...in Column 2


    Let me know if you have any questions.

    Looking forward for the solutions and always appreciate your help.

    Thank you

    Riz Momin
    Attached Files Attached Files

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Alphabetically Order list

    if I understant u properly u wanna get unique values in column B.... so u can use advanced filter option...
    http://office.microsoft.com/en-us/excel/HP100739431033.aspx"]See how to get unique values with advanced filter[/URL]
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Alphabetically Order list

    No ...

    First it needs to delete all blank rows.
    Then delete duplicate company names ( 1 entry stays)
    Then sort Alphabetically...

    The above needs to be done thru Macro...so please help

    Thank U

    Riz

  4. #4
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Alphabetically Order list

    Ok. Try this Macro

    Sub Tesr()
        Dim LastRow As Long, j As Long
        Dim MyRange As Range, Cell As Range
        
        With Range("A:A")
            LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
        End With
        Set MyRange = Range("A1:A" & LastRow)
    
        Application.ScreenUpdating = False
        
    '   Deleting dublicates and blang rows
        For j = LastRow To 1 Step -1
            With WorksheetFunction
                If .CountIf(Range("A1:A" & j), Range("A" & j)) > 1 Or _
                        Range("A" & j).Value = "" Or _
                        Len(Range("A" & j)) = 1 Then
                    Rows(j).Delete
                End If
            End With
        Next j
        
        LastRow = Range("A1").End(xlDown).Row
        Set MyRange = Range("A1:A" & LastRow)
        
        MyRange.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlYes
        With Range("A1")
            .Interior.Color = 65535
            .Font.Bold = True
            .Font.Color = -16776961
            .EntireColumn.AutoFit
            .Select
        End With
    
        Application.ScreenUpdating = True
    End Sub

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Alphabetically Order list

    This works great! and solve my problem.

    Thanks a lot...

    Riz Momin

+ 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