LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel sorting in VBScript

I'm having trouble with Excel sorting in a VBScript. I have a number of
cells containing data, starting at row 4. I'm trying to sort each column
from row 4 through to the end using the following code:

Set objRange = objExcel.Range(Chr(64+column)+"4", Chr(64+column)&row ).Select
Set objRange2 = objExcel.Range(Chr(64+column)+"4")
objRange.Sort objRange2,,,,,,,1

objRange is my range, objRange2 is the first cell of the column I wish to
sort.

I also tried:

objRange.Sort objRange,,,,,,,1

The sort method does not work in VBScript, nor do a large number of
variations of it! I know from a lot of reading that some Excel functionality
isn't exposed too well in VBScript...

However, the following works for the entire column, using a header row:

Set objRange = objExcel.ActiveCell.EntireColumn
objRange.Sort objRange,,,,,,,1

Any suggestions would be much appreciated.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run VBScript from Excel Amy M Excel Discussion (Misc queries) 4 September 19th 08 09:07 PM
Excel & VBScript Bill Ebbing Excel Programming 7 September 8th 05 06:27 PM
Using excel through vbscript ashtom1 Excel Programming 6 July 6th 05 02:55 PM
VBScript code behind Excel jjjjj Excel Programming 2 November 23rd 04 10:36 PM
VBScript Automation of Excel Spreadsheet Sorting & Filtering Tom Ogilvy Excel Programming 1 September 10th 03 03:01 PM


All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"