Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort cells in Excel

Status
Not open for further replies.

GeorgeDurkee

Programmer
Feb 22, 2000
47
US
I want to use VB to sort an Escel spreadsheet I just populated. When I use this command
xlSheet.Cells.Sort key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
I get an error 1004, Method 'Range' of object _Global failed. Error 1004 is the general automation error, so I can't get any help on it.

Occasionally, it works.

what is the easiest, most reliable way to sort an Excel spreadsheet from VB code that generates it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top