ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro conversion from Lotus 1-2-3 to Excel (Sort Macro) (https://www.excelbanter.com/excel-programming/410321-macro-conversion-lotus-1-2-3-excel-sort-macro.html)

cgsteel

Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)
 
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

Jim Thomlinson

Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)
 
Something like this is probably close...

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

Jim Thomlinson


"cgsteel" wrote:

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


cgsteel

Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)
 
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

"Jim Thomlinson" wrote:

Something like this is probably close...

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

Jim Thomlinson


"cgsteel" wrote:

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


Jim Thomlinson

Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)
 
You are exactly correct on both counts...
--
HTH...

Jim Thomlinson


"cgsteel" wrote:

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

"Jim Thomlinson" wrote:

Something like this is probably close...

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

Jim Thomlinson


"cgsteel" wrote:

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


Jim Thomlinson

Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)
 
Sorry Data1 should be in quotes...

Sheets("A").Range("Data1"). ...

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

You are exactly correct on both counts...
--
HTH...

Jim Thomlinson


"cgsteel" wrote:

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

"Jim Thomlinson" wrote:

Something like this is probably close...

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

Jim Thomlinson


"cgsteel" wrote:

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


Don Guillett

Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)
 
Sheets("A").Range("data1")
Guess should be OK
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"cgsteel" wrote in message
...
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

"Jim Thomlinson" wrote:

Something like this is probably close...

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

Jim Thomlinson


"cgsteel" wrote:

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



cgsteel

Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)
 
Thanks Jim and Don!!!

I appreciate the help.
Carlos

"Don Guillett" wrote:

Sheets("A").Range("data1")

Guess should be OK
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"cgsteel" wrote in message
...
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

"Jim Thomlinson" wrote:

Something like this is probably close...

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

Jim Thomlinson


"cgsteel" wrote:

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




cgsteel

Macro conversion from Lotus 1-2-3 to Excel (Sort Macro)
 
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

"Jim Thomlinson" wrote:

Sorry Data1 should be in quotes...

Sheets("A").Range("Data1"). ...

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

You are exactly correct on both counts...
--
HTH...

Jim Thomlinson


"cgsteel" wrote:

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

"Jim Thomlinson" wrote:

Something like this is probably close...

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

Jim Thomlinson


"cgsteel" wrote:

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


Don Guillett

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

Have you tried RECORDING a macro while you do it manually ?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"cgsteel" wrote in message
...
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

"Jim Thomlinson" wrote:

Sorry Data1 should be in quotes...

Sheets("A").Range("Data1"). ...

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

You are exactly correct on both counts...
--
HTH...

Jim Thomlinson


"cgsteel" wrote:

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

"Jim Thomlinson" wrote:

Something like this is probably close...

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

Jim Thomlinson


"cgsteel" wrote:

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




All times are GMT +1. The time now is 08:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com