+ Reply to Thread
Results 1 to 10 of 10

Auto sort

  1. #1
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Auto sort

    Hello again

    data is being entered Rows b3 - R3 and entered each day
    So far data extends to b120 - r120

    Now I am entering at the botton row each time but there is need to sort - mostly by date.
    I could run a macro but would have to change it as the rows increased
    Is there code when run finds the last row abd does the sort

    Data starts at b3

    Help appreciated

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,795

    Re: Auto sort

    You could set the range dynamically in your macro before you run the sort i.e.

    Please Login or Register  to view this content.
    Alf

  3. #3
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Re: Auto sort

    Thank you will try and let you know

  4. #4
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Re: Auto sort

    Can you assist me with the code to allow for:-

    1. when a row data has been entered - b to r and the enter is pressed that the sort begins
    2. Data starts b13 - R13
    3. Data is being added daily
    4. Currently at Row b120
    5, B row is a date
    6. Sort to be because of the date

    Hope this clarifies

  5. #5
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,795

    Re: Auto sort

    when a row data has been entered - b to r and the enter is pressed that the sort begins
    Not sure this is the best of ideas. When entering data I presume you fill in values from column B to column R so if sorting is set to fire when "Enter" is pressed you may get some funny results in your database as sorting will started every time a value is entered.

    Why not set up a macro that fires when you press "Ctrl" + Z? Much safer in my opinion.

    It could also be possible to use the "Private Sub Worksheet_Change(ByVal Target As Range)" function.

    As you have changed you request a bit from your 1st post I would suggest you upload a small workbook with your data.

    Alf

  6. #6
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Re: Auto sort

    Do you have any suggestions relating to the code for the Private sub?

  7. #7
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Re: Auto sort

    Have attacted a sample file
    Hope this assists

    Help appreciated
    Attached Files Attached Files

  8. #8
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,795

    Re: Auto sort

    You could try this code and see if it works for you.

    Please Login or Register  to view this content.
    To "activate" this code right click on the sheet "Merchant". Click on "View Code" and paste this code in the windows that opens.

    This code will sort the range B10 to L?? depending on what is the row number for the last cell with a value in column B. The macro "fires" as soon as a value is entered in column B.

    As you said in your first post that the range to be filtered should be from B3 to R??? I'm a bit unsure about what range to use but in the end decided to set up the macro based on info in your uploaded file. If this differs from the file you use change TheList range and sort Key1 to suit you.

    Alf
    Last edited by Alf; 02-08-2013 at 02:44 AM.

  9. #9
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Re: Auto sort

    Thanks.
    Works fine and appreciate the help

  10. #10
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,795

    Re: Auto sort

    Glad to be of help and thanks for feedback.

    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1