Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)

C

cgsteel

I'm trying to create a Macro in Excel to do what my Lotus macro would do for
me.

My Lotus macro did the following:

1) Goto to sheet A cell A1
2) It defined the data range to sort --- I had predefined data ranges which
were included in the Macro.
3) Selection of Primary key by moving over from cell A1 to the column that
contains the Primary key to sort by........ I would move 14 columns over.
4) Selection of Descending or Ascending and then execute

Can data ranges be defined within the Excel Macro?

I don't care if the macro does exactly what I was doing in Lotus so I'm open
to any suggestions.

I appreciate your help in advance!!!

Thanks
Carlos
 
J

Jim Thomlinson

Something like this is probably close...

sub Sort Stuff()
Sheets("A").Range("A1:Z100").sort Key1:=range("N1"), Order1:=xlAscending, _
Header:=xlYes
End sub
 
C

cgsteel

Jim,

Can the range be defined as a named range?

Example: You put Sheets("A").Range("A1:Z100").......can it be
Sheets("A").Range(data1)

Data1 = would be the range name that defines "A1:Z100".

If there is no Header, would the code be === Header:=xlNo ?

Thanks
Carlos
 
C

cgsteel

Jim,

The code below sorts column "A" but if I wanted to add a level to the sort
that would sort column "B".

How would I do that?

Range("data1").Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo

Thanks for your help.
Carlos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top