+ Reply to Thread
Results 1 to 2 of 2

Adding a sort to userform code

  1. #1
    Registered User
    Join Date
    07-03-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2007
    Posts
    41

    Adding a sort to userform code

    Hi all I have a userform to add new records to a worksheet. It works fine, but assigns a reference number based on that of the previous record. If the worksheet isn't sorted correctly it gives an incorrect reference number.
    I thought this would be simple however whenever I come to add new code to this routine I receive errors in the already written and working parts of the code( Type Mismatch). I can only imagine this means that although the routine works, it does have errors in the way its written.


    Can someone please tell me what I have missed?


    Please Login or Register  to view this content.


    Thank you

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Adding a sort to userform code

    Hi, excelloser,

    maybe WorksheetFunction.Max will deliver the correct result if itīs numbers (you can add 1 to that for the next number). BTW: your code should be worked over thoroughly - I personally dislike Forms that let me do all the work and check at the very end when all has been filled out.

    Ciao,
    Holger

+ 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