+ Reply to Thread
Results 1 to 6 of 6

after add new details from userform to ws sort ws (column A to last row an last Column)

  1. #1
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    after add new details from userform to ws sort ws (column A to last row an last Column)

    I am trying to adapt this code to sort worksheet "DriverDetails" by column A after an addition of information. The sub SortDetails() is called by the update macro.

    It is not sorting and I cant see why. Code should take account of any number of rows and any number of columns. Data has a header row.

    Please Login or Register  to view this content.
    Any pointers appreciated....

  2. #2
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: after add new details from userform to ws sort ws (column A to last row an last Column

    Hi,
    Did you checked what values of LastRow and LastColumn when sortdetails() starts?

    May be this way:
    Please Login or Register  to view this content.
    Last edited by kasan; 02-01-2017 at 06:23 AM.

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: after add new details from userform to ws sort ws (column A to last row an last Column

    Hi Arkadi, Can I do that with

    MsgBox "A1:" & Cells(LastRow, LastColumn).Address(0, 0)

    yep I can so that is reading correct range "A1:AT77"

    so the alphabetical sort isn't working because it is not referencing column A as sort column
    Last edited by nigelog; 02-01-2017 at 07:11 AM.

  4. #4
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: after add new details from userform to ws sort ws (column A to last row an last Column

    Sorted
    Please Login or Register  to view this content.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,308

    Re: after add new details from userform to ws sort ws (column A to last row an last Column

    How about this ?

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: after add new details from userform to ws sort ws (column A to last row an last Column

    A lot neater code Bakerman Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Arranging two column's based on one column's details
    By papusale in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 09-07-2016, 07:05 PM
  2. UserForm Button to Sort a Column
    By ajupillai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2016, 05:01 PM
  3. Replies: 5
    Last Post: 02-18-2016, 12:51 PM
  4. Replies: 2
    Last Post: 10-06-2015, 11:27 PM
  5. Need to extract particular details from entire column
    By prakashmak in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 07-10-2013, 05:27 AM
  6. [SOLVED] Sort by column E, and create sheets named by that column, add header and data
    By salaso69 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-24-2012, 12:42 AM
  7. Sort a multi column listbox in userform
    By Martin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2005, 05:05 PM

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