D
Dean
I have a macro that is supposed to copy a list of things in a column from
one worksheet to another, then, after the pasting, it is to sort the
selection.
It works fine but, occasionally, the list is a list of only one item. And
if I then let it sort, since it doesn't see anything below the top of the
list, it grabs data that it sees in other adjacent columns, which I don't
want. Actually, if there is just one cell being sorted, there is no need to
sort! So, can someone modify my code below so that if the cells in the
column being pasted actually consists of only one cell, it will just skip
the sort. Here is what I have that needs to be modified:
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'IF SELECTION CONSISTS OF ONLY ONE CELL, SKIP THE SORT BELOW
Selection.Sort Key1:=ActiveCell, Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Thanks!
Dean
one worksheet to another, then, after the pasting, it is to sort the
selection.
It works fine but, occasionally, the list is a list of only one item. And
if I then let it sort, since it doesn't see anything below the top of the
list, it grabs data that it sees in other adjacent columns, which I don't
want. Actually, if there is just one cell being sorted, there is no need to
sort! So, can someone modify my code below so that if the cells in the
column being pasted actually consists of only one cell, it will just skip
the sort. Here is what I have that needs to be modified:
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'IF SELECTION CONSISTS OF ONLY ONE CELL, SKIP THE SORT BELOW
Selection.Sort Key1:=ActiveCell, Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Thanks!
Dean