Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sorting with code


I want to sort data with a header row, can get it to work right, i'm
not to good at this. please help.

Private Sub cmdTIEImport_Click()

Workbooks.Open "C:\Documents and Settings\User\Desktop\11_01_2005.xls",
, False
AppActivate "Microsoft Excel"
ActiveSheet.Range("B:G,J:K,M:N,P:T,V:V,X:X,AC:AF,A H:AT,AV:BQ").Select
Selection.Delete Shift:=xlToLeft
ActiveSheet.Cells.Select
Cells.EntireColumn.AutoFit
ActiveSheet.Range("N1").Select
ActiveCell.FormulaR1C1 = "Dept Owner"
ActiveSheet.Range("O1").Select
ActiveCell.FormulaR1C1 = "Transaction Completed By"
ActiveSheet.Range("P1").Select
ActiveCell.FormulaR1C1 = "Control findings"
ActiveSheet.Range("Q1").Select
ActiveCell.FormulaR1C1 = "Results if errors not corrected"
ActiveSheet.Cells.Select
ActiveSheet.Cells.EntireColumn.AutoFit

I've tried the follwing for the sort, first one and then the other,
neither works.

1. ActiveSheet.Range("c1").Select
ActiveSheet.Range("c1").Sort Key1:=Columns("c1"), Header:=xlGuess

2. 'Worksheets("11_01_05").Range("C1").Sort _
'Key1:=Worksheets("11_01_05").Columns("C1"), Header:=xlGuess

Any suggestions appreciated
Thx


--
JohnDK
------------------------------------------------------------------------
JohnDK's Profile: http://www.excelforum.com/member.php...fo&userid=7184
View this thread: http://www.excelforum.com/showthread...hreadid=482015

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sorting with code


Range("C1:C15").Select
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

There are other ways to sort but this is the one I use. Hopefilly it
helps you.

Good Luck.


I want to sort data with a header row, can get it to work right, i'm
not to good at this. please help.

Private Sub cmdTIEImport_Click()

Workbooks.Open "C:\Documents and Settings\User\Desktop\11_01_2005.xls",
, False
AppActivate "Microsoft Excel"
ActiveSheet.Range("B:G,J:K,M:N,P:T,V:V,X:X,AC:AF,A H:AT,AV:BQ").Select
Selection.Delete Shift:=xlToLeft
ActiveSheet.Cells.Select
Cells.EntireColumn.AutoFit
ActiveSheet.Range("N1").Select
ActiveCell.FormulaR1C1 = "Dept Owner"
ActiveSheet.Range("O1").Select
ActiveCell.FormulaR1C1 = "Transaction Completed By"
ActiveSheet.Range("P1").Select
ActiveCell.FormulaR1C1 = "Control findings"
ActiveSheet.Range("Q1").Select
ActiveCell.FormulaR1C1 = "Results if errors not corrected"
ActiveSheet.Cells.Select
ActiveSheet.Cells.EntireColumn.AutoFit

I've tried the follwing for the sort, first one and then the other,
neither works.

1. ActiveSheet.Range("c1").Select
ActiveSheet.Range("c1").Sort Key1:=Columns("c1"), Header:=xlGuess

2. 'Worksheets("11_01_05").Range("C1").Sort _
'Key1:=Worksheets("11_01_05").Columns("C1"), Header:=xlGuess

Any suggestions appreciated
Thx


--
goober
------------------------------------------------------------------------
goober's Profile: http://www.excelforum.com/member.php...o&userid=19838
View this thread: http://www.excelforum.com/showthread...hreadid=482015

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
code for sorting Jack Sons Excel Discussion (Misc queries) 4 September 29th 09 08:23 AM
Sorting in code Ayo Excel Discussion (Misc queries) 4 July 19th 08 11:47 PM
Sorting by code Jay Excel Discussion (Misc queries) 1 February 8th 08 05:55 PM
Sorting Using Code Jim May Excel Programming 1 August 29th 04 10:19 PM
code for sorting wessj Excel Programming 2 August 12th 03 04:20 PM


All times are GMT +1. The time now is 01:12 AM.

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

About Us

"It's about Microsoft Excel"