ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort Code (https://www.excelbanter.com/excel-programming/348989-sort-code.html)

Newbie1092

Sort Code
 
I created this macro that when executed will use a second sheet I created to
sort te contents in the cell I'm currently selecting. I would like to take
the process one step further and have this code loop until there there isn't
any more data to sort. Here are the specifics of the sheet. All of the data I
need to sort is in column E starting on row 2. The number of rows in the
sheet is not constant. It coulld be 50 rows or 3000 rows.

My next step will be to move the functions I have on the other workbook to
the same workbook as the data but on a different sheet.


Sub Sort()
Application.DisplayAlerts = False
'
' Sort Macro
' Macro recorded 12/27/2005
'

'
Windows("Code Report Tool.xls").Activate
Range("A1").Select
Application.CutCopyMode = False
Selection.ClearContents
Rows("3:3").Select
Selection.ClearContents
Windows("Bank XXX Code reports 12-23-05.xls").Activate
Selection.Copy
Windows("CODE Report Tool.xls").Activate
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("A3"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True,
Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5,
1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11, 1),
Array(12, 1)), _
TrailingMinusNumbers:=True
Rows("3:3").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _
DataOption1:=xlSortNormal
Range("A19").Select
Selection.Copy
Range("A8").Select
Windows("Bank XXX CODE reports 12-23-05.xls").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Application.DisplayAlerts = True
End Sub


All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com