Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
mrice
 
Posts: n/a
Default Sorting


The following macro should do this for you. I'm assuming that all the
data is in column A and the rest of the sheet is empty

Sub Reformat()
LastRow = Cells(65536, 1).End(xlUp).Row
For N = LastRow To 1 Step -1
If Application.CountIf(Range(Cells(1, 2), Cells(LastRow, 256)),
Cells(N, 1)) 0 Then
Cells(N, 1).Delete shift:=xlUp
Else
ItemCount = Application.CountIf(Columns(1), Cells(N, 1))
If ItemCount 1 Then
If Cells(1, ItemCount) = "" Then
Cells(1, ItemCount) = Cells(N, 1)
Else
Cells(65536, ItemCount).End(xlUp).Offset(1, 0) =
Cells(N, 1)
End If
Cells(N, 1).Delete shift:=xlUp
End If
End If
Next N
End Sub


--
mrice


------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=533627

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting SnobbishJade New Users to Excel 6 April 2nd 06 02:08 AM
Sorting Data in ascending order sharon2006 Excel Discussion (Misc queries) 1 March 14th 06 01:07 AM
sorting non contiguous ranges gsh20 Excel Discussion (Misc queries) 1 September 8th 05 04:50 PM
sorting number in ascending order Janice Lee via OfficeKB.com Excel Discussion (Misc queries) 2 April 8th 05 10:31 PM
Adding a KeyID column for sorting Rebecca New Users to Excel 3 February 20th 05 07:09 PM


All times are GMT +1. The time now is 12:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"