LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default error trying to sort data

Also, 2nd For..Next loop isn't right way to go. Here's a revised sub
that works right...

Sub Print_MTD3()
Dim sz, st, i As Integer
Dim wksSource As Worksheet, wksTarget As Worksheet

Const sSourceRanges As String = _
"$A:$A,$AY:$AY,$C:$C,$G:$G,$I:$I,$BG:$BG,$K:$K ,"
_
&
"$V:$V,$O:$O,$T:$T,$M:$M,$AE:$AE,$BB:$BB,$U:$U ," _
& "$N:$N,$S:$S,$AS:$AS,$AW:$AW,BJ1:BJ105"
Const sTargetRanges As String = _
"A:A,B:B,C:C,D:D,E:E,F:F,G:G,H:H,I:I,J:J,K:K," _
& "L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S1:S105"
Const sFormula1 As String = _
"=""Last Updated - ""&TEXT(Max(A:A),""mm/dd/yy"")"

Set wksSource = Workbooks("Analytics.xlsm").Sheets("MTD")
Workbooks.Add xlWBATWorksheet
Set wksTarget = ActiveSheet

st = Split(sTargetRanges, ",")
For Each sz In Split(sSourceRanges, ",")
wksSource.Range(sz).Copy wksTarget.Range(st(i)): i = i + 1
Next 'sz
With wksTarget
.Range("S1:S105").Formula = sFormula1
If .FilterMode Then .ShowAllData
.Outline.ShowLevels ColumnLevels:=1
.Columns("A").UnMerge
.Columns("E").Sort Key1:=Range("E2"), Order1:=xlAscending
End With
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc




 
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
Bubble sort Error (Compile Error: Type Mismtach) Excel Monkey[_2_] Excel Programming 6 April 24th 09 12:16 AM
Pls. reply Sort Data and copy to next coulmn when sort order chang shital shah Excel Programming 1 August 19th 05 02:51 PM
Sort Data and copy to next coulmn when sort data changes shital shah Excel Programming 0 August 18th 05 02:55 PM
Sort Data and copy to next coulmn when sort data changes shital shah Excel Programming 0 August 18th 05 06:48 AM
How do I sort a column of data and have each data row sort accordi Oedalis Excel Discussion (Misc queries) 1 March 17th 05 11:52 PM


All times are GMT +1. The time now is 02:51 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"