View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
jfcby[_2_] jfcby[_2_] is offline
external usenet poster
 
Posts: 121
Default Sort Column, Excel 2000 & 2003

Hello,

I've been really struggling with Sort Column macro! During my search
for a sort code I've found one but I do not know how to get it to sort
Sheet2 ColumnC?

Sub SortArray()

Dim myArr1 As Variant
Dim iCtr As Long
Dim jCtr As Long
Dim Temp As Variant

myArr1 = Array("H", "WH", "O", "B", "A")

For iCtr = LBound(myArr1) To UBound(myArr1) - 1
For jCtr = iCtr + 1 To UBound(myArr1)
If myArr1(iCtr) myArr1(jCtr) Then
Temp = myArr1(iCtr)
myArr1(iCtr) = myArr1(jCtr)
myArr1(jCtr) = Temp
End If
Next jCtr
Next iCtr

For iCtr = LBound(myArr1) To UBound(myArr1)
MsgBox iCtr & "--" & myArr1(iCtr)
Next iCtr

End Sub

Thank you for your help,
jfcby



jfcby wrote:
Hello,

On worksheet2 I have 3 columns that gets added to daily.
ColumnA is Description, ColumnB is Dates, & ColumnC is standard
abbrivations
Christmas 12/25/2006 H
Labor day 9/03/2006 H
Birthday 7/10/2006 B
Annivarsey 9/05/2006 A
Testing 11/02/2006 O

I want to sort on ColumnC keeping all my H together. So how can I sort
columnC so that all my H are kept together in this order H, WH, O, B, A
each letter will multiply dates and descriptions?

Thank you for your help in advance,
jfcby