Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone,
I have a section of code which repeats with minimal changes ( 2 items per repeat) These two items represent the original column copied and the column it is copying to. Is there any way I could simplify my code using an array and looping through it? Thanks for the help, John My original code is as follows: Worksheets(2).Select Columns("X:X").Clear Worksheets(2).Range("P1:P" & lastrow).AdvancedFilter Action:=xlFilterCopy, _ CopyToRange:=Range("X1"), Unique:=True Columns("X:X").Select Selection.Sort Key1:=Range("X2"), Order1:=xlAscending, Header:=xlYes Selection.Copy Sheets("Menu").Select Columns("I:I").PasteSpecial Paste:=xlPasteValues Worksheets(2).Select Columns("X:X").Clear Worksheets(2).Range("A1:A" & lastrow).Select Selection.AdvancedFilter Action:=xlFilterCopy, _ CopyToRange:=Range("X1"), Unique:=True Columns("X:X").Select Selection.Sort Key1:=Range("X2"), Order1:=xlAscending, Header:=xlYes Selection.Copy Sheets("Menu").Select Columns("J:J").PasteSpecial Paste:=xlPasteValues |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
creating an array | New Users to Excel | |||
creating an array | Excel Worksheet Functions | |||
creating an array from range help | Excel Programming | |||
creating an array on the fly | Excel Programming | |||
Creating an array | Excel Programming |