Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default 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

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
Sorting a Range cmm Excel Discussion (Misc queries) 1 June 30th 06 01:35 PM
sorting a range cjsmith22 Excel Discussion (Misc queries) 2 November 13th 05 11:19 PM
Problem with Sorting Data reggiebu Excel Discussion (Misc queries) 2 June 9th 05 09:37 PM
data sorting problem Pong Excel Worksheet Functions 0 February 18th 05 05:45 PM
data sorting problem Pong Excel Worksheet Functions 0 February 18th 05 05:39 PM


All times are GMT +1. The time now is 04:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"