ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Q.1 (https://www.excelbanter.com/excel-worksheet-functions/176870-q-1-a.html)

kbee

Q.1
 
how to format a cell in a 'sorting column' so that every time i put an entry
in the cell it will be sorted in its right position- in the column, i guess
it need to be after I finish entering all the other cells in the row? how
please?
thanx,
bee

Don Guillett

Q.1
 
If you are entering more than one now then wait and just use a regular sub.
Record a macro to see what is happening and then post back with more info
and your efforts. IF?? you are only entering ONE at this time then use a
worksheet_change event within the sheet module. Examples would be helpful.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"kbee" wrote in message
...
how to format a cell in a 'sorting column' so that every time i put an
entry
in the cell it will be sorted in its right position- in the column, i
guess
it need to be after I finish entering all the other cells in the row? how
please?
thanx,
bee



Gord Dibben

Q.1
 
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rng As Range
Set rng = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
If Target.Column < 6 Then Exit Sub
Application.ScreenUpdating = False
ActiveCell.CurrentRegion.Select
With Selection
.Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End With
rng.Select
Application.ScreenUpdating = False
End Sub

Will sort the currentregion by column C when you enter out last cell of column F

Adjust to suit.

Right-click on the sheet tab and "View Code".

Copy/paste into that module.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 11:22:02 -0800, kbee wrote:

how to format a cell in a 'sorting column' so that every time i put an entry
in the cell it will be sorted in its right position- in the column, i guess
it need to be after I finish entering all the other cells in the row? how
please?
thanx,
bee



Gord Dibben

Q.1
 
One caveat with type of autosorting is................

If you misspell an entry the sorting takes place and you may have a problem
finding the misspelled entry.


Gord

On Fri, 15 Feb 2008 12:51:32 -0800, Gord Dibben <gorddibbATshawDOTca wrote:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rng As Range
Set rng = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
If Target.Column < 6 Then Exit Sub
Application.ScreenUpdating = False
ActiveCell.CurrentRegion.Select
With Selection
.Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
End With
rng.Select
Application.ScreenUpdating = False
End Sub

Will sort the currentregion by column C when you enter out last cell of column F

Adjust to suit.

Right-click on the sheet tab and "View Code".

Copy/paste into that module.


Gord Dibben MS Excel MVP

On Fri, 15 Feb 2008 11:22:02 -0800, kbee wrote:

how to format a cell in a 'sorting column' so that every time i put an entry
in the cell it will be sorted in its right position- in the column, i guess
it need to be after I finish entering all the other cells in the row? how
please?
thanx,
bee




All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com