English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have the following code that sorts a table by 9 columns but when i run it in Excel 2007 the data is not sorted (works fine in excel 2003)
How can i get it to work?

Worksheets("Sheet1").Range("B2:AB4").Sort _
Key1:=Worksheets("Sheet1").Range("Z1"), _
Key2:=Worksheets("Sheet1").Range("AA1"), _
Key3:=Worksheets("Sheet1").Range("AB1")

Worksheets("Sheet1").Range("B2:AB4").Sort _
Key1:=Worksheets("Sheet1").Range("W1"), _
Key2:=Worksheets("Sheet1").Range("X1"), _
Key3:=Worksheets("Sheet1").Range("Y1")

Worksheets("Sheet1").Range("B2:AB4").Sort _
Key1:=Worksheets("Sheet1").Range("T1"), _
Key2:=Worksheets("Sheet1").Range("U1"), _
Key3:=Worksheets("Sheet1").Range("V1")

2007-10-10 00:34:38 · 3 answers · asked by Nathan C 2 in Computers & Internet Programming & Design

3 answers

the simplest way if way you have isn't working is to make an a new macro and manually go thru the steps. Then you'll have the code.

2007-10-10 01:06:59 · answer #1 · answered by AJ 7 · 1 1

What format is the help which you get from the device? Is it delimited or fastened width; without bunch of extraneous records interior the combination? no rely if it particularly is, then it particularly is copied into Excel and separated into columns utilising the text fabric to Columns function. Then formula could be utilized to the help to get the outcomes which you're searching for for. it particularly is even achieveable that Pivot Tables might desire to furnish the answer on your undertaking. VBA is probably no longer mandatory. If the calculations are what you describe above, the toughest area of the job could be to get the help into Excel. i assume that your equipment has the skill to furnish you the help as a text fabric checklist of a few variety. With a pattern of the uncooked records and the spreadsheet which you're utilising, i does no longer strategies attempting to sparkling up your undertaking. The formula used (in undeniable language variety) could be mandatory as i'm no longer a scientific individual. deliver me a message in case you have an interest.

2016-11-07 21:10:58 · answer #2 · answered by clapper 4 · 0 0

Part of your coding has been cut off so it is hard to say. But I'd recommend using the Macro Recorder and going through the steps to reach the same desired outcome. Then go back and edit that macro coding to simplify or make the code more compatible to general use.

If there are changes in the style of coding for 2007 the Macro Recorder should pick them up.

2007-10-10 05:17:38 · answer #3 · answered by devilishblueyes 7 · 1 0

fedest.com, questions and answers