LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default range definition by cells numbers

I am trying to sort a few columns. This is the code I have. It does not work

it tells me that the sort reference is not valid

Sub Macro2()
Dim AKO As Range
Dim BKO as Range
Set AKO = Range(Sheet3.Cells(2, 13), Sheet3.Cells(362, 66)) 'Range("M2:M362")
Set BKO = Range(Sheet3.Cells(2, 13), Sheet3.Cells(362, 13)) 'Range("M2:M362")

ActiveWorkbook.Worksheets("RESULTS").Sort.SortFiel ds.Clear
ActiveWorkbook.Worksheets("RESULTS").Sort.SortFiel ds.Add Key:=AKO, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("RESULTS").Sort
.SetRange BKO
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

End Sub

 
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
Range definition thewizz Excel Programming 2 October 29th 07 06:22 PM
Range Definition [email protected] Excel Programming 1 December 15th 06 11:28 AM
Using Address in Range Definition?? Don G Excel Programming 4 April 1st 06 01:18 AM
How come this range definition is invalid? keepITcool Excel Programming 1 June 21st 04 07:15 PM
Using Cells( ) for Range definition [email protected] Excel Programming 5 September 2nd 03 08:04 PM


All times are GMT +1. The time now is 01:59 PM.

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

About Us

"It's about Microsoft Excel"