View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] sbitaxi@gmail.com is offline
external usenet poster
 
Posts: 158
Default Sort macro error

Can anyone help me with this? I keep getting a "Reference is not
valid" error 1004, and I can't figure out why. I've used the sort code
before and it worked fine. Now... No clue.

sKey is a reference to a cell, user picks the field from a drop down
and it enters the field value in the sKey source cell

LastRow is a function Ron de Bruin shared with me to find the last row
containing data

Ultimately, it is the segment for sorting that is "out of sorts".

Here's the code:

If sKey 0 Then
DestSh.Select
Last = LastRow(DestSh)
Range("A4:AZ" & Last).Select

Selection.Sort key1:=sKey, Order1:=xlAscending, Header:=xlNo,
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Else
End If


Thank you!

Steven