Sorting Rows/Columns Automatically

B

BG

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?
 
S

Shane Devenshire

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top