×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Sort

Sort

(OP)
I am trying to sort in excel using VBA.

My code is

CODE

Worksheets("Information").Range("N69:R1500").Sort _
    Key1:=Worksheets("Information").Range("R1500"), _
    Key2:=Worksheets("Information").Range("O69")

Problem is that its starts at the N,1500 and moves up to 1499, 1498, and so on. I would like it to start at N,69 then move down to n,70 N,71 and so on.

Any help would be awesome,
Daniel

RE: Sort

Do you mean that you want to switch from ascending order to descending order?  If so, use

CODE

Worksheets("Information").Range("N69:R1500").Sort _
    Key1:=Worksheets("Information").Range("R1500"), _
    Order1:=xlDescending, _
    Key2:=Worksheets("Information").Range("O69")

or

CODE

Worksheets("Information").Range("N69:R1500").Sort _
    Key1:=Worksheets("Information").Range("R1500"), _
    Order1:=xlAscending, _
    Key2:=Worksheets("Information").Range("O69")

RE: Sort

(OP)
I want my results to start on cell N69. Doestn matter Ascending or Descending..

RE: Sort

So... are you saying that your unsorted data does not reach to row 1500 and when you sort the data it sorts blank cells to the top?

RE: Sort

(OP)
Thats what im trying to say, thank you.

RE: Sort

(OP)
I found my problem.

CODE

Worksheets("Information").Range("N69:R1500").Sort _
    Key1:=Worksheets("Information").Range("N69"), _
    Order1:=xlDescending, _
    Key2:=Worksheets("Information").Range("R1")
thanks.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources