>Can anyone tell me how to automate a sort in excel? I've tried several varieations on the macro code but can't quite seem to get it right.
>
>Here's my latest try which doesn't work.
>
>oSheet.Range("A6:W155").Sort(_Key1:=oSheet.Range("D6"))
>
>Thanks in advance for any help.
I think VFP will have trouble with the named parameters; try to use parameters by position. In case of doubt, click on "Sort" in the macro editor (in Excel), and press F1, to get alternative syntaxes.
If the macro editor gives you named parameters, AFAIK, these are usually in the correct order for the un-named version; that is, you can probably just omit "_Key1:=".
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)