View Single Post
 
Old 12-06-2018, 07:19 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

Quote:
Can you not sort the data to arrange it alphabetically?
You didn't bother to answer that question. Perhaps you're still thinking about it.

Every record can be added to the bottom of the table then sorted into its correct location.
Here's how the macro recorder handles the sort.
Code:
Sub Macro1()
'
' Macro1 Macro
' sort by last name
'

'
    Range("D2").Select
    ActiveWorkbook.Worksheets("DATA").ListObjects("tDATA").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("DATA").ListObjects("tDATA").Sort.SortFields.Add Key _
        :=Range("D2"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortTextAsNumbers
    With ActiveWorkbook.Worksheets("DATA").ListObjects("tDATA").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub
Reply With Quote