Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
jdengel
 
Posts: n/a
Default shorter macro

is there a way to shorten this macro to make it run faster
thanks
JD


Range("C:C,D:D,E:E,F:F,G:G,H:H,I:I").Select
Range("I1").Activate
ActiveWindow.SmallScroll ToRight:=6
Range("C:C,D:D,E:E,F:F,G:G,H:H,I:I,J:P").Select
Range("J1").Activate
ActiveWindow.SmallScroll ToRight:=4
Range("C:C,D:D,E:E,F:F,G:G,H:H,I:I,J:P,Q:Q,R:R,S:S ,T:T,U:U").Select
Range("U1").Activate
ActiveWindow.SmallScroll ToRight:=7
Range("C:C,D:D,E:E,F:F,G:G,H:H,I:I,J:P,Q:Q,R:R,S:S ,T:T,U:U,V:V,W:W,X:X").Select
Range("X1").Activate
ActiveWindow.SmallScroll ToRight:=6
Range( _
"C:C,D:D,E:E,F:F,G:G,H:H,I:I,J:P,Q:Q,R:R,S:S,T:T,U :U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA"
_
).Select
Range("AA1").Activate
Selection.ClearContents
ActiveWindow.SmallScroll ToRight:=-23
Selection.Delete Shift:=xlToLeft
ActiveWindow.SmallScroll ToRight:=1
Range("D:D,G:G").Select
Range("G1").Activate
ActiveWindow.SmallScroll ToRight:=5
Range("D:D,G:G,H:H,J:J,K:K").Select
Range("K1").Activate
ActiveWindow.SmallScroll ToRight:=3
Range("D:D,G:G,H:H,J:J,K:K,L:CI").Select
Range("L1").Activate
Selection.ClearContents
Selection.Delete Shift:=xlToLeft
Columns("K:K").Select
ActiveWindow.SmallScroll ToRight:=-3
Range("I:I,J:J,K:K,L:AE").Select
Range("L1").Activate
ActiveWindow.SmallScroll ToRight:=9
Range("I:I,J:J,K:K,L:AE,AF:AX").Select
Range("AF1").Activate
Selection.ClearContents
Selection.Delete Shift:=xlToLeft
ActiveWindow.SmallScroll ToRight:=-5
Columns("F:F").Select
Columns("A:A").ColumnWidth = 10.57
Columns("B:B").ColumnWidth = 6.29
Columns("C:C").ColumnWidth = 32.57
Columns("E:E").ColumnWidth = 15
Selection.ColumnWidth = 7.57
Columns("G:G").ColumnWidth = 12.57
Columns("H:H").ColumnWidth = 10.86
Selection.AutoFilter
Range("B2").Select
Selection.AutoFilter
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="TRUE"


  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

Dim vWidths As Variant
Dim i As Long
Application.ScreenUpdating = False
Range("C:AA,AC:AC,AF:AG,AI:DH,DK:EZ").Delete Shift:=xlToLeft
vWidths = Array(10.57, 6.29, 32.57, 15, 7.57, 12.57, 10.86)
For i = 1 To UBound(vWidths)
Columns(i).ColumnWidth = vWidths(i)
Next i
Range("B2").AutoFilter Field:=2, Criteria1:="TRUE"
Application.ScreenUpdating = True

Note that you almost never need to select anything. Using the range
objects directly (i.e., Range("C:AA...").Delete) is faster, shorter,
and, IMO, easier to maintain.


In article ,
"jdengel" wrote:

is there a way to shorten this macro to make it run faster

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
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 03:31 PM.

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"