I am not an Office developer by nature so this question may seem simple, but
it eludes my current knowledge-set.
Lets say I have a spreadsheet with numerical data in one colum. I want to
output that data into a text file sorted without changing the data
arrangement in the original spreadsheet.
Here is some sample code to generate data in colum "A":
Dim wb As Workbook
Set wb = Application.ActiveWorkbook
Dim ws As Worksheet
Set ws = wb.ActiveSheet
' create some unsorted dummy data
ws.Range("a1") = "2"
ws.Range("a2") = "4"
ws.Range("a3") = "6"
ws.Range("a4") = "8"
ws.Range("a5") = "0"
ws.Range("a6") = "1"
ws.Range("a7") = "3"
ws.Range("a8") = "5"
ws.Range("a9") = "7"
ws.Range("a10") = "9"
This next line of code does sort of what I want, but the sort does not
happen in memory, it actually changes the spreadsheet which I do not want to
happen.
ws.Range("a1:b10").Sort Range("a1"), xlAscending
So how can I do this in memory so I in effect do not change any of the
original data (or its order) on the spreadsheet. Should be simple.
TIA