Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 70
Default auto sorting help needed thank you!

Hello, I submitted a post the other day, I was wondering if any one
experienced could give me some advice on automatic sorting. I have two sheets
that are linked together by the last column when the number in the last
column changes everyday with new information pasted into sheet two the
numbers are either higher or lower. In order to keep the positions in from
highest to lowest, the ideal situation for this database is to have the sheet
automatically sort when that last column changes. changes made from J6 - J40
(last column) and when that changes entire row (stock ticker stock etc) needs
to be sorted as well. Is that an "if" function. I tried to add a code (right
click on sheet 1) and view code and entered what I was told but it hasnt work

This was my first discussion group message abotu this topic:
"I currently am working on a excel spreadsheet that needs to be a working
database. It is currently linked to bloomberg, (stock prices are
automatically fed and updated) (live feed) The only column that will change
everyday is the last one, although when the last one changes the positions of
the stocks need to be sorted based on that last column in ascending order.
can anyone assist me with this. I am on a deadline and have been working on
this project for the last week, not which direction i should be going with
this."



Thank you in advance!!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default auto sorting help needed thank you!

Put the following macro in the worksheet event code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set rj = Range("J6:J40")
Set rall = Range("A6:IV256")
If Intersect(Target, rj) Is Nothing Then Exit Sub
Application.EnableEvents = False
rall.Sort Key1:=Range("J6")
Application.EnableEvents = True
End Sub

Once installed, any changes to J6 thru J40 will automatically trigger a
re-sort of rows 6 thru 40.


Because it is worksheet code, it is very easy to install and automatic to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm




--
Gary''s Student - gsnu200757


"Vicki" wrote:

Hello, I submitted a post the other day, I was wondering if any one
experienced could give me some advice on automatic sorting. I have two sheets
that are linked together by the last column when the number in the last
column changes everyday with new information pasted into sheet two the
numbers are either higher or lower. In order to keep the positions in from
highest to lowest, the ideal situation for this database is to have the sheet
automatically sort when that last column changes. changes made from J6 - J40
(last column) and when that changes entire row (stock ticker stock etc) needs
to be sorted as well. Is that an "if" function. I tried to add a code (right
click on sheet 1) and view code and entered what I was told but it hasnt work

This was my first discussion group message abotu this topic:
"I currently am working on a excel spreadsheet that needs to be a working
database. It is currently linked to bloomberg, (stock prices are
automatically fed and updated) (live feed) The only column that will change
everyday is the last one, although when the last one changes the positions of
the stocks need to be sorted based on that last column in ascending order.
can anyone assist me with this. I am on a deadline and have been working on
this project for the last week, not which direction i should be going with
this."



Thank you in advance!!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default auto sorting help needed thank you!

Vicki, did you ever get this working? If you want to send me a copy of your
workbook, I will try to do it within the next couple of days.


Regards,
Ryan---


--
RyGuy


"Gary''s Student" wrote:

Put the following macro in the worksheet event code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set rj = Range("J6:J40")
Set rall = Range("A6:IV256")
If Intersect(Target, rj) Is Nothing Then Exit Sub
Application.EnableEvents = False
rall.Sort Key1:=Range("J6")
Application.EnableEvents = True
End Sub

Once installed, any changes to J6 thru J40 will automatically trigger a
re-sort of rows 6 thru 40.


Because it is worksheet code, it is very easy to install and automatic to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm




--
Gary''s Student - gsnu200757


"Vicki" wrote:

Hello, I submitted a post the other day, I was wondering if any one
experienced could give me some advice on automatic sorting. I have two sheets
that are linked together by the last column when the number in the last
column changes everyday with new information pasted into sheet two the
numbers are either higher or lower. In order to keep the positions in from
highest to lowest, the ideal situation for this database is to have the sheet
automatically sort when that last column changes. changes made from J6 - J40
(last column) and when that changes entire row (stock ticker stock etc) needs
to be sorted as well. Is that an "if" function. I tried to add a code (right
click on sheet 1) and view code and entered what I was told but it hasnt work

This was my first discussion group message abotu this topic:
"I currently am working on a excel spreadsheet that needs to be a working
database. It is currently linked to bloomberg, (stock prices are
automatically fed and updated) (live feed) The only column that will change
everyday is the last one, although when the last one changes the positions of
the stocks need to be sorted based on that last column in ascending order.
can anyone assist me with this. I am on a deadline and have been working on
this project for the last week, not which direction i should be going with
this."



Thank you in advance!!

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
Help needed for sorting the data and plotting graph SPV New Users to Excel 1 June 26th 07 09:01 PM
Help needed for sorting the data and plotting graph SPV Excel Discussion (Misc queries) 0 June 25th 07 08:28 AM
Auto rename and save prompt needed. Gizmo63 Excel Worksheet Functions 0 February 7th 06 02:00 PM
Help, experts needed! Auto notification Melanie Excel Discussion (Misc queries) 1 January 23rd 06 06:22 PM
Sorting help needed! BrettOlbrys Excel Discussion (Misc queries) 7 December 30th 05 11:57 AM


All times are GMT +1. The time now is 04:05 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"