View Single Post
 
Old 01-05-2016, 03:06 PM
gebobs gebobs is offline Windows 7 64bit Office 2010 64bit
Expert
 
Join Date: Mar 2014
Location: Atlanta
Posts: 837
gebobs has a spectacular aura aboutgebobs has a spectacular aura about
Default

OIC...yeah, there's a way to do that. It takes code. Here is one I made with a lot of help from one of the code gurus here. For the data selected in multiple columns, this will put them all in another column with a blank column between and sort the results. You can delete the sort or change the output column as you see fit.

Code:
Sub Unwind()

  Dim OutCell As Range
  Ctr = 0
  
  Set OutCell = Selection.Cells(1, 1).Offset(0, Selection.Columns.Count + 1)
  
  For Each Cell In Selection
    OutCell.Offset(Ctr, 0).Value = Cell.Value
    Ctr = Ctr + 1
  Next Cell
  
  ActiveWorkbook.Worksheets("Totaler").Sort.SortFields.Clear
  ActiveWorkbook.Worksheets("Totaler").Sort.SortFields.Add Key:=Range("F1"), _
    SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    
  With ActiveWorkbook.Worksheets("Totaler").Sort
    .SetRange Range("F1:F10709")
    .Header = xlNo
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
  End With
  
  Selection.End(xlUp).Select
  
End Sub
Reply With Quote