Problem with Range and Sorting Data
I am trying to sort data. The area of the data will continually change, so I
defined a range name and was trying to use that to sort. My problem is that
the range expands itself when I run the macro. Earlier in the macro I find a
cell, copy it, and paste it to another section of the worksheet. My VBA code
for it is listed below...what am I doing wrong? ("IC" is the range name)
Range("A7").Select
Cells.Find(What:=InputBox("Enter Territory number you wish to search
for.", "Enter Territory Number."), After:=ActiveCell, LookIn:=xlValues,
LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False).Activate
ActiveCell.EntireRow.Select
Selection.Cut
Cells.Find(What:=InputBox("Enter a territory number of a distributor in
the IC grouping.")).Select
Selection.Insert Shift:=xlDown
Selection.Sort Key1:=Range("IC"), Order1:=xlAscending, Header:=xlGuess,
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A7").Select
|