|
-
Nov 21st, 2011, 10:45 AM
#1
Thread Starter
New Member
[RESOLVED] VB 6.5 Data sort function
Hi,
I'm new to VB and I'm trying to sort a region of data in Excel using the following code
Sheets(1).Range("A6").Select
ActiveCell.CurrentRegion.Select
Selection.Sort Key1:=Range("H2"), Order1:=xlAscending, _
Key2:=Range("D2") , Order2:=xlAscending, Key3:=Range("B2"), _
Order3:=xlAscending, Header:= xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,_
DataOption2:=xlSortNormal, DataOption3:= xlSortNormal
but I keep getting an error message which says 'Identifier under cursor not recognised' and highlights the code in yellow, or which says 'The sort reference is not valid. Make sure that it's within the data you want to sort, and the first Sort By box isn't the same or blank'. I am not that new to sorting data but I've been completely unable to solve this - if anyone has any idea about what this could be, I would greatly appreciate it.
Thanks,
Kerry
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|