ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Sorting Rows/Columns Automatically (https://www.excelbanter.com/excel-worksheet-functions/220145-sorting-rows-columns-automatically.html)

BG

Sorting Rows/Columns Automatically
 
I have a spreadsheet and I want to sort rows and columns automatically as I
enter data into blank cells. What is the best way to do this?

Gary''s Student

Sorting Rows/Columns Automatically
 
Use a Change event worksheet macro.
--
Gary''s Student - gsnu200832


"BG" wrote:

I have a spreadsheet and I want to sort rows and columns automatically as I
enter data into blank cells. What is the best way to do this?


Shane Devenshire[_2_]

Sorting Rows/Columns Automatically
 
Hi,

Here is sample code for a change event:


Private Sub Worksheet_Change(ByVal Target As Range)
Dim isect As Range
Set isect = Application.Intersect(Target, Range("A1"))
If Not isect Is Nothing Then
'Your code here
End If
End Sub

If this is for sheet1 then
1. press Alt+F11
2. double click the Sheet1 object in the top left corner of the screen (the
Project window)
3. add your code.

In your case you may want to record the sort routine so you can put it into
the "your code here" location.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"BG" wrote:

I have a spreadsheet and I want to sort rows and columns automatically as I
enter data into blank cells. What is the best way to do this?



All times are GMT +1. The time now is 05:15 AM.

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