Question Regarding Auto-Sorting Data

G

golf4wff

Hi, Everyone -

It's been tooooo long since I've been on the Forum - hope everyone is doing ok.

I have a quick question on a project I'm working on for work - a rent comparability tool. My question is:

1. I have one sheet that contains all kinds of apartment/unit data including what we know as "Gross Rent" (rent amount plus utilities). What I would like to happen is, when I add new apartment data to the sheet and save the sheet, the sheet will automatically sort the data from highest gross rent to lowest gross rent without having to manually keep resorting the data. Cananyone help me with this issue?

Thanks so much for the help.

Frank
 
C

Claus Busch

Hi Frank,

Am Tue, 11 Mar 2014 21:10:12 -0700 (PDT) schrieb (e-mail address removed):
1. I have one sheet that contains all kinds of apartment/unit data including what we know as "Gross Rent" (rent amount plus utilities). What I would like to happen is, when I add new apartment data to the sheet and save the sheet, the sheet will automatically sort the data from highest gross rent to lowest gross rent without having to manually keep resorting the data. Can anyone help me with this issue?

try it with Workbook_BeforeSave event (Modify the sheet name, the range
and key1 to suit):

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Sheets("Sheet1").UsedRange.Sort key1:=Range("B1"), order1:=xlDescending
End Sub


Regards
Claus B.
 

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