View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
parr301 parr301 is offline
external usenet poster
 
Posts: 1
Default Problem programming the Sort command

I was having the same problem trying to sort a data table that is stored in
an add-in. I think that William Benson is on the right track.

This worked for me...each time that you refer to the range, you need to
define the worksheet.

ExcelAppRecipe.Selection.Sort Key1:=ExcelAppRecipe.Range("B5"),
Order1:=xlAscending


"marshy26" wrote:

Thanks for the replies. I've tried both solutions that have been
suggested but I'm still having problems?
What I have noticed is, if I create a macro in excel to do the sort and
then add the following line it works.

ExcelAppRecipe.Application.Run "'Theale SH Recipe.xls'!Sort_ID"

I don't really want to do it this way and would rather go down the
route i was going if it is possible?

I've done a few searches on the net and have tried various ways of
using the sort command but I'm still getting error 1004 :o(

Thanks once again