Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default autosorting two attached columns

I am creating an invoice with the following auto sort function:

Private Sub Worksheet_Change(ByVal Target As Range)
Range("d10:d28").Sort Key1:=Range("d10"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

D column is product codes, but the C column is quantities. such as:
C D
4 95733
12 97003
1 55691

I need the quantities to move with the product codes when I enter new codes.
The D column is sorting correctly, but the C column quantities stay put. Any
help would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default autosorting two attached columns

You're only sorting D10:D28.

Maybe you want to use C10:D28 or something else??????

Montana wrote:

I am creating an invoice with the following auto sort function:

Private Sub Worksheet_Change(ByVal Target As Range)
Range("d10:d28").Sort Key1:=Range("d10"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

D column is product codes, but the C column is quantities. such as:
C D
4 95733
12 97003
1 55691

I need the quantities to move with the product codes when I enter new codes.
The D column is sorting correctly, but the C column quantities stay put. Any
help would be appreciated.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default autosorting two attached columns

Change: Range("d10:d28").Sort
To: Range("c10:d28").Sort

Merjet

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default autosorting two attached columns

Yes, that did it. Much thanks.

"Dave Peterson" wrote:

You're only sorting D10:D28.

Maybe you want to use C10:D28 or something else??????

Montana wrote:

I am creating an invoice with the following auto sort function:

Private Sub Worksheet_Change(ByVal Target As Range)
Range("d10:d28").Sort Key1:=Range("d10"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End Sub

D column is product codes, but the C column is quantities. such as:
C D
4 95733
12 97003
1 55691

I need the quantities to move with the product codes when I enter new codes.
The D column is sorting correctly, but the C column quantities stay put. Any
help would be appreciated.


--

Dave Peterson

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
Keeping Adjacent Columns Attached to a Pivot Table Eddie Excel Worksheet Functions 1 January 5th 08 12:23 AM
AUTOSORTING FARAZ QURESHI Excel Discussion (Misc queries) 2 January 16th 07 10:25 PM
match two columns (with equal dates) and their attached datasets Claudia Excel Discussion (Misc queries) 1 September 1st 06 04:16 AM
AutoSorting OlYeller21[_2_] Excel Programming 2 July 15th 06 08:22 PM
autosorting to a leaderboard ano Excel Discussion (Misc queries) 1 December 2nd 05 04:17 PM


All times are GMT +1. The time now is 11:19 AM.

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

About Us

"It's about Microsoft Excel"