[AccessD] Array sorting

Jim DeMarco Jdemarco at hshhp.org
Thu Aug 7 08:13:41 CDT 2003


How do you plan to handle A11, A12, A20, A21, etc.?  As strings these won't sort in the order that they appear in Excel.  You'll probably be better off using a two dimension array, one for the column (alpha) and one for the row (numeric), and concatenate them as strings when you need them.
 
<code>
Function RangeNameToArray()
Dim i As Integer
Dim j As Integer
Dim iNumCols As Integer
Dim iNumRows As Integer
Dim arrExcelRange() As String

    'Get the number of cols and rows
    'you'll have to write code to parse the range to determine which values to use here
    'this codes uses your sample range A1:C3
    iNumCols = Asc("C") - Asc("A")
    iNumRows = 3 - 1
    ReDim arrExcelRange(iNumCols, iNumRows)
    For i = 0 To iNumCols
        For j = 0 To iNumRows
            arrExcelRange(i, j) = (Chr(65 + i)) & CStr(j + 1)
            Debug.Print arrExcelRange(i, j)
        Next j
    Next i
End Function
</code>

HTH, 

Jim DeMarco 
Director of Product Development 
HealthSource/Hudson Health Plan 

-----Original Message-----
From: Powell, David (BBM) [mailto:david.powell at bbm.wapl.com.au]
Sent: Wednesday, August 06, 2003 10:41 PM
To: AccessD
Subject: [AccessD] Array sorting



Hi Listers, 

I have a single dimension array of excel cell references stored as string values.  I was wondering how you can sort a range that is say A1:C3 from A1, A2, A3, B1... C3 to A1, B1, C1, A2, B2...C3?  Any help would be greatly appreciated.


regards 

David 

---------------------------------------------------- 
David Powell 
Computing Support Officer 
Worsley Alumina Pty Ltd 
Bauxite Mine 
Boddington WA 6390 
Ph: +61 8 9734 8269 
FAX: +61 8 9734 8250 
 <Mailto:david.powell at bbm.wapl.com.au> Mailto:david.powell at bbm.wapl.com.au WAPL Web Page  <http://www.wapl.com.au> http://www.wapl.com.au 
---------------------------------------------------- 
<<Powell, David (BBM).vcf>> 



NOTICE - This message and any attached files may contain information that is confidential and/or subject of legal privilege 
intended only for use by the intended recipient. If you are not the intended recipient or the person responsible for delivering 
the message to the intended recipient, be advised that you have received this message in error and that any dissemination, 
copying or use of this message or attachment is strictly forbidden, as is the disclosure of the information therein. 
If you have received this message in error please notify the sender immediately and delete the message
Worsley Alumina Pty Ltd ABN 58 008 905 155 is the manager of the Worsley Joint Venture - Bauxite/Alumina Operation.
Liability and responsibility of the Joint Venturers is several in accordance with the following schedule of participating interests:
Billiton Aluminium (RAA) Pty Ltd 56 percent, Billiton Aluminium (Worsley) Pty Ltd 30 percent, 
Kobe Alumina Associates (Australia) Pty Limited 10 percent, Nissho Iwai Alumina Pty Limited 4 percent.




***********************************************************************************
"This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited.  If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message.  Thank You".
***********************************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030807/5639c4a3/attachment-0001.html>


More information about the AccessD mailing list