Condense Working Formula?

ECUPIRATE

New Member
Joined
Jun 13, 2017
Messages
25
The following code is ALOT... is there a way to simplify it? It was most likely recorded. I'm sure it slows down the Macro significantly... and it hurts my eyes :eek::eek:

Rows("1:1").Select
Selection.AutoFilter
Columns("F:F").Select
Selection.Cut
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
Columns("K:K").Select
Selection.Cut
Columns("F:F").Select
Selection.Insert Shift:=xlToRight
Columns("M:M").Select
Selection.Cut
Columns("G:G").Select
Selection.Insert Shift:=xlToRight
Columns("O:O").Select
Selection.Cut
Columns("H:H").Select
Selection.Insert Shift:=xlToRight
Columns("W:W").Select
Selection.Cut
Columns("I:I").Select
Selection.Insert Shift:=xlToRight
Columns("R:R").Select
Selection.Cut
Columns("J:J").Select
Selection.Insert Shift:=xlToRight
Columns("S:S").Select
Selection.Cut
Columns("K:K").Select
Selection.Insert Shift:=xlToRight
Columns("T:T").Select
Selection.Cut
Columns("L:L").Select
Selection.Insert Shift:=xlToRight
Columns("AF:AF").Select
Selection.Cut
Columns("M:M").Select
Selection.Insert Shift:=xlToRight
Columns("AI:AI").Select
Selection.Cut
Columns("N:N").Select
Selection.Insert Shift:=xlToRight
Columns("AA:AA").Select
Selection.Cut
Columns("O:O").Select
Selection.Insert Shift:=xlToRight
Columns("AE:AE").Select
Selection.Cut
Columns("P:P").Select
Selection.Insert Shift:=xlToRight
Columns("AF:AF").Select
Selection.Cut
Columns("Q:Q").Select
Selection.Insert Shift:=xlToRight
Columns("AE:AE").Select
Selection.Cut
Columns("R:R").Select
Selection.Insert Shift:=xlToRight
Columns("AE:AE").Select
Selection.Cut
Columns("S:S").Select
Selection.Insert Shift:=xlToRight
Columns("AC:AC").Select
Selection.Cut
Columns("Y:Y").Select
Selection.Insert Shift:=xlToRight
Columns("AE:AE").Select
Selection.Cut
Columns("AD:AD").Select
Selection.Insert Shift:=xlToRight
Columns("AK:AK").Select
Selection.Cut
Columns("AE:AE").Select
Selection.Insert Shift:=xlToRight
Columns("AL:AL").Select
Selection.Cut
Columns("AF:AF").Select
Selection.Insert Shift:=xlToRight
Columns("AO:AO").Select
Selection.Cut
Columns("AG:AG").Select
Selection.Insert Shift:=xlToRight
Columns("AP:AP").Select
Selection.Cut
Columns("AH:AH").Select
Selection.Insert Shift:=xlToRight
Columns("AR:AR").Select
Selection.Cut
Columns("AI:AI").Select
Selection.Insert Shift:=xlToRight
Columns("AO:AO").Select
Selection.Cut
Columns("AJ:AJ").Select
Selection.Insert Shift:=xlToRight
Columns("AP:AP").Select
Selection.Cut
Columns("AK:AK").Select
Selection.Insert Shift:=xlToRight
Columns("AQ:AQ").Select
Selection.Cut
Columns("AL:AL").Select
Selection.Insert Shift:=xlToRight
Columns("AW:AW").Select
Selection.Cut
Columns("I:I").Select
Selection.Insert Shift:=xlToRight
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi
You can get rid of all the .select & Selection like this
Code:
    Application.ScreenUpdating = False
    Rows("1:1").AutoFilter
    Columns("F:F").Cut
    Columns("E:E").Insert Shift:=xlToRight
    Columns("K:K").Cut
    Columns("F:F").Insert Shift:=xlToRight
    Application.ScreenUpdating = True
Also the first & last lines should help your eyes:)
 
Upvote 0

Forum statistics

Threads
1,215,403
Messages
6,124,714
Members
449,182
Latest member
mrlanc20

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top