ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting a column (https://www.excelbanter.com/excel-programming/339394-sorting-column.html)

elkrat

Sorting a column
 
I have users that need to modify Excel (2000) files that are raw data tables
dumped from an AS400 query. All the tables are identical in fields, structure
etc and have to have the same modifications made to each. I have created
code that deletes the unwanted data, but I also need to sort on one column -
Lname (column F). Because the files are only used to clean up and the list of
names is then exported for other use, I had to create the code in a permanent
second file - which is kept open. It would be nice if the code would sort
without making the user perform a separate sort.

this is the code I am using:

Dim rngSort as Range
Set rngSort = ActiveSheet.Range("F2")
rngSort.Sort Key1:=Range("F2")

I get an "error 400" when I run this. I think its because the code is in a
separate file. Any thoughts or suggestions would be helpful.

Gary Keramidas[_2_]

Sorting a column
 
have you tried recording a macro as you perform the sort operation. then you
can use that code

--


Gary


"elkrat" wrote in message
...
I have users that need to modify Excel (2000) files that are raw data
tables
dumped from an AS400 query. All the tables are identical in fields,
structure
etc and have to have the same modifications made to each. I have created
code that deletes the unwanted data, but I also need to sort on one
column -
Lname (column F). Because the files are only used to clean up and the list
of
names is then exported for other use, I had to create the code in a
permanent
second file - which is kept open. It would be nice if the code would sort
without making the user perform a separate sort.

this is the code I am using:

Dim rngSort as Range
Set rngSort = ActiveSheet.Range("F2")
rngSort.Sort Key1:=Range("F2")

I get an "error 400" when I run this. I think its because the code is in a
separate file. Any thoughts or suggestions would be helpful.




Tom Ogilvy

Sorting a column
 
try

Dim rngSort as Range
Set rngSort = ActiveSheet.Range("F2")
rngSort.Sort Key1:=ActiveSheet.Range("F2")

--
Regards,
Tom Ogilvy


"elkrat" wrote in message
...
I have users that need to modify Excel (2000) files that are raw data

tables
dumped from an AS400 query. All the tables are identical in fields,

structure
etc and have to have the same modifications made to each. I have created
code that deletes the unwanted data, but I also need to sort on one

column -
Lname (column F). Because the files are only used to clean up and the list

of
names is then exported for other use, I had to create the code in a

permanent
second file - which is kept open. It would be nice if the code would sort
without making the user perform a separate sort.

this is the code I am using:

Dim rngSort as Range
Set rngSort = ActiveSheet.Range("F2")
rngSort.Sort Key1:=Range("F2")

I get an "error 400" when I run this. I think its because the code is in a
separate file. Any thoughts or suggestions would be helpful.




elkrat

Sorting a column
 
I tried that. I get the same error 400 message.

"Gary Keramidas" wrote:

have you tried recording a macro as you perform the sort operation. then you
can use that code

--


Gary


"elkrat" wrote in message
...
I have users that need to modify Excel (2000) files that are raw data
tables
dumped from an AS400 query. All the tables are identical in fields,
structure
etc and have to have the same modifications made to each. I have created
code that deletes the unwanted data, but I also need to sort on one
column -
Lname (column F). Because the files are only used to clean up and the list
of
names is then exported for other use, I had to create the code in a
permanent
second file - which is kept open. It would be nice if the code would sort
without making the user perform a separate sort.

this is the code I am using:

Dim rngSort as Range
Set rngSort = ActiveSheet.Range("F2")
rngSort.Sort Key1:=Range("F2")

I get an "error 400" when I run this. I think its because the code is in a
separate file. Any thoughts or suggestions would be helpful.





elkrat

Sorting a column
 
Bingo! thanks.

"Tom Ogilvy" wrote:

try

Dim rngSort as Range
Set rngSort = ActiveSheet.Range("F2")
rngSort.Sort Key1:=ActiveSheet.Range("F2")

--
Regards,
Tom Ogilvy


"elkrat" wrote in message
...
I have users that need to modify Excel (2000) files that are raw data

tables
dumped from an AS400 query. All the tables are identical in fields,

structure
etc and have to have the same modifications made to each. I have created
code that deletes the unwanted data, but I also need to sort on one

column -
Lname (column F). Because the files are only used to clean up and the list

of
names is then exported for other use, I had to create the code in a

permanent
second file - which is kept open. It would be nice if the code would sort
without making the user perform a separate sort.

this is the code I am using:

Dim rngSort as Range
Set rngSort = ActiveSheet.Range("F2")
rngSort.Sort Key1:=Range("F2")

I get an "error 400" when I run this. I think its because the code is in a
separate file. Any thoughts or suggestions would be helpful.






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

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