#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Column sorting

I want to be able to re-sort two columns of information every time I make a
new entry. I want it to start in alphabetical order in the first column and
finish off evenly in the second. ex:

column A Column B
a e if I make an entry to column
A (f), I want the
b g program to sort it and place
it in column B
c h between the e and g. It
needs to resize the
d columns and make both column
entries equal.
f

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default Column sorting

Try this:

Sub ABCDEF()
'Set the two columns here as Col1 and Col2
Const Col1 = "A"
Const Col2 = "B"
Dim LastRow As Long, NextRow As Long
LastRow& = Range(Col2 & Rows.Count).End(xlUp).Row
NextRow& = Range(Col1 & Rows.Count).End(xlUp).Row + 1
Range(Col2 & "1:" & Col2 & LastRow&).Cut _
Destination:=Range(Col1 & NextRow&)
Range(Col1 & NextRow&).Select
Columns(Col1 & ":" & Col1).Select
Selection.Sort Key1:=Range(Col1 & "1"), Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
LastRow& = Range(Col1 & Rows.Count).End(xlUp).Row
Range(Col1 & (CInt(LastRow& / 2) + 1) & ":" & Col1 & LastRow&).Cut _
Destination:=Range(Col2 & "1")
Range(Col2 & "1").Select
End Sub

No provision was made for column headings.

Hope this helps,

Hutch

"ukyob" wrote:

I want to be able to re-sort two columns of information every time I make a
new entry. I want it to start in alphabetical order in the first column and
finish off evenly in the second. ex:

column A Column B
a e if I make an entry to column
A (f), I want the
b g program to sort it and place
it in column B
c h between the e and g. It
needs to resize the
d columns and make both column
entries equal.
f

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Column sorting



"Tom Hutchins" wrote:

Try this:

Sub ABCDEF()
'Set the two columns here as Col1 and Col2
Const Col1 = "A"
Const Col2 = "B"
Dim LastRow As Long, NextRow As Long
LastRow& = Range(Col2 & Rows.Count).End(xlUp).Row
NextRow& = Range(Col1 & Rows.Count).End(xlUp).Row + 1
Range(Col2 & "1:" & Col2 & LastRow&).Cut _
Destination:=Range(Col1 & NextRow&)
Range(Col1 & NextRow&).Select
Columns(Col1 & ":" & Col1).Select
Selection.Sort Key1:=Range(Col1 & "1"), Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
LastRow& = Range(Col1 & Rows.Count).End(xlUp).Row
Range(Col1 & (CInt(LastRow& / 2) + 1) & ":" & Col1 & LastRow&).Cut _
Destination:=Range(Col2 & "1")
Range(Col2 & "1").Select
End Sub

No provision was made for column headings.

Hope this helps,

Hutch

"ukyob" wrote:

I want to be able to re-sort two columns of information every time I make a
new entry. I want it to start in alphabetical order in the first column and
finish off evenly in the second. ex:

column A Column B
a e if I make an entry to column
A (f), I want the
b g program to sort it and place
it in column B
c h between the e and g. It
needs to resize the
d columns and make both column
entries equal.
f

Thanks for the info. Hutch. I need to explain that I am not well versed in
Excel therefore I really do not know how to use the formula you provided.
Can you start me off? Better yet can you provide me with an excel
spreadsheet with examples and all I have to do is substitute my information.
My e-mail is
Thanks again for your effort and time.
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Column sorting



"ukyob" wrote:



"Tom Hutchins" wrote:

Try this:

Sub ABCDEF()
'Set the two columns here as Col1 and Col2
Const Col1 = "A"
Const Col2 = "B"
Dim LastRow As Long, NextRow As Long
LastRow& = Range(Col2 & Rows.Count).End(xlUp).Row
NextRow& = Range(Col1 & Rows.Count).End(xlUp).Row + 1
Range(Col2 & "1:" & Col2 & LastRow&).Cut _
Destination:=Range(Col1 & NextRow&)
Range(Col1 & NextRow&).Select
Columns(Col1 & ":" & Col1).Select
Selection.Sort Key1:=Range(Col1 & "1"), Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
LastRow& = Range(Col1 & Rows.Count).End(xlUp).Row
Range(Col1 & (CInt(LastRow& / 2) + 1) & ":" & Col1 & LastRow&).Cut _
Destination:=Range(Col2 & "1")
Range(Col2 & "1").Select
End Sub

No provision was made for column headings.

Hope this helps,

Hutch

"ukyob" wrote:

I want to be able to re-sort two columns of information every time I make a
new entry. I want it to start in alphabetical order in the first column and
finish off evenly in the second. ex:

column A Column B
a e if I make an entry to column
A (f), I want the
b g program to sort it and place
it in column B
c h between the e and g. It
needs to resize the
d columns and make both column
entries equal.
f

Thanks for the info. Hutch. I need to explain that I am not well versed in
Excel therefore I really do not know how to use the formula you provided.
Can you start me off? Better yet can you provide me with an excel
spreadsheet with examples and all I have to do is substitute my information.
My e-mail is
Thanks again for your effort and time.


Thanks for the reply. I should have known that the formula was a macro. I
just was not thinking. The program works beautifully. Thanks again for your
time and effort.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Data From One Column into Multiple Columns Justin Hoffmann Excel Worksheet Functions 2 July 12th 06 04:15 PM
IF/AND/OR/DATEIF Issue...sorry...long post... EDSTAFF Excel Worksheet Functions 1 November 10th 05 12:28 AM
Running total w/2 columns - Excel Anna / Ideal Excel Worksheet Functions 14 August 10th 05 04:28 PM
Right column doesn't change when sorting left column. nohope Excel Discussion (Misc queries) 2 July 19th 05 03:27 PM
Lookup Table Dilemma Karen Excel Worksheet Functions 2 June 10th 05 08:22 PM


All times are GMT +1. The time now is 04:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"